Re: [PHP-DEV] Why i believe we need final
MB Sure it cannot because insert cannot. The problem and the error you did MB above is that you split an operation into two. Your real operation is MB insert_with_password and that is different from insert. Again insert is an That's the whole point of OO - to allow overloading the same operation, so even classes that do not know about implementation details could use it. MB as a member and not as a base class. Maybe it is now a good thing to MB have a generalised container interface and declare insert in the container MB implementations final. Highly specialised containers would then inheritd I do not see why should container interface be final. MB A class that is derived from a concrete container may in some container MB implementations have final functions. For example whatever inherits a fifo Still have no explanation why anyone would need it. Just to disallow overriding because we can? I see no added value in that. MB If you have another insert implementation in a class than you MB missused inheritance. If the operation is different than your derived MB class is no for example no longer a fifo. Instead it uses a fifo. Implementation can be different and still be a fifo. That depends on overriding implementation. Again, I still have yet to see any example where the proposed 'final' plays substantial role and not just is there because 'maybe someone might want to use it'. -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ +972-3-6139665 ext.109 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Segmention fault when doing make install
Fixed. At 01:44 28/01/2003, Magnus Määttä wrote: This is in current head. (cd .libs rm -f libphp4.la ln -s ../libphp4.la libphp4.la) Installing PHP SAPI module Installing shared extensions: /usr/local/www/php5mincli/lib/php/extensions/debug-non-zts-20020429/ Installing PEAR environment: /usr/local/www/php5mincli/lib/php/ [Tue Jan 28 00:38:20 2003] Script: '/opt/DEV/php/php5/pear/install-pear.php' --- /opt/DEV/php/php5/Zend/zend_execute.h(66) : Block 0xBFFF99C0 status: Beginning: Overrun (magic=0xBFFF99F4, expected=0x7312F8DC) make[1]: *** [install-pear-installer] Segmentation fault (core dumped) make: *** [install-pear] Error 2 00:38 N0v3ll /opt/DEV/php/php5 # gdb sapi/cli/php core GNU gdb 5.3 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as i686-pc-linux-gnu... Core was generated by `/opt/DEV/php/php5/sapi/cli/php -n -dsafe_mode 0 /opt/DEV/php/php5/pear/install-'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/libcrypt.so.1...done. Loaded symbols for /lib/libcrypt.so.1 Reading symbols from /lib/libresolv.so.2...done. Loaded symbols for /lib/libresolv.so.2 Reading symbols from /lib/libm.so.6...done. Loaded symbols for /lib/libm.so.6 Reading symbols from /lib/libdl.so.2...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /lib/libnsl.so.1...done. Loaded symbols for /lib/libnsl.so.1 Reading symbols from /lib/libc.so.6...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /lib/libnss_files.so.2...done. Loaded symbols for /lib/libnss_files.so.2 #0 0x401211bc in memcpy () from /lib/libc.so.6 (gdb) bt full #0 0x401211bc in memcpy () from /lib/libc.so.6 No symbol table info available. #1 0x0815d1e6 in _mem_block_check (ptr=0xbfff99e4, silent=1, __zend_filename=0x81c6200 /opt/DEV/php/php5/Zend/zend_execute.h, __zend_lineno=66, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /opt/DEV/php/php5/Zend/zend_alloc.c:678 p = (struct _zend_mem_header *) 0xbfff99c0 no_cache_notice = 0 valid_beginning = 1 had_problems = 0 end_magic = 0 #2 0x0815d1a8 in _mem_block_check (ptr=0xbfff99e4, silent=1, __zend_filename=0x81c6200 /opt/DEV/php/php5/Zend/zend_execute.h, __zend_lineno=66, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /opt/DEV/php/php5/Zend/zend_alloc.c:670 p = (struct _zend_mem_header *) 0xbfff99c0 no_cache_notice = 0 valid_beginning = 1 had_problems = 0 end_magic = 0 #3 0x0815c621 in _efree (ptr=0xbfff99e4, __zend_filename=0x81c6200 /opt/DEV/php/php5/Zend/zend_execute.h, __zend_lineno=66, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /opt/DEV/php/php5/Zend/zend_alloc.c:225 p = (struct _zend_mem_header *) 0xbfff99c0 real_size = 48 cache_index = 6 #4 0x08168a4b in safe_free_zval_ptr (p=0xbfff99e4) at /opt/DEV/php/php5/Zend/zend_execute.h:66 No locals. #5 0x08166e38 in _zval_ptr_dtor (zval_ptr=0x401d4c14, __zend_filename=0x81c9220 /opt/DEV/php/php5/Zend/zend_execute.h, __zend_lineno=120) at /opt/DEV/php/php5/Zend/zend_execute_API.c:319 No locals. #6 0x0818da22 in zend_ptr_stack_clear_multiple () at /opt/DEV/php/php5/Zend/zend_execute.h:120 p = (void **) 0x401d4c14 delete_count = 0 #7 0x08189b86 in zend_do_fcall_common_helper (execute_data=0xbfffa8e0, op_array=0x403d9968) at /opt/DEV/php/php5/Zend/zend_execute.c:2677 original_return_value = (struct _zval_struct **) 0xc8 current_scope = (struct _zend_class_entry *) 0x81f9b98 current_this = (struct _zval_struct *) 0xbfffa3f0 return_value_used = 1 #8 0x08189d1b in zend_do_fcall_handler (execute_data=0xbfffa8e0, op_array=0x403d9968) at /opt/DEV/php/php5/Zend/zend_execute.c:2724 fname = (struct _zval_struct *) 0x403ac1ac #9 0x08184a99 in execute (op_array=0x403d9968) at /opt/DEV/php/php5/Zend/zend_execute.c:1217 execute_data = {opline = 0x403ac188, function_state = {function_symbol_table = 0x4040f4c8, function = 0x403d9968, reserved = {0x8182b13, 0x81ded38, 0x40376968, 0x44}}, fbc = 0x0, fbc_constructor = 0x40376974, op_array = 0x403d9968, object = 0x0, Ts = 0xbfff9e4c, original_in_execution = 1 '\001', calling_scope = 0x44, prev_execute_data = 0xbfffaac0} #10 0x0818985c in zend_do_fcall_common_helper (execute_data=0xbfffaac0, op_array=0x40360b40) at /opt/DEV/php/php5/Zend/zend_execute.c:2630 calling_symbol_table = (struct _hashtable *) 0x40424904 original_return_value = (struct _zval_struct **) 0xbfffad9c current_scope = (struct
[PHP-DEV] ibase_connect and ibase_pconnect
Hi, we have an application, which connects to a database of type interbase. We can see, that the times of the connects go very high, if more people call our site at the same time. Per default we use the function ibase_connect and at the end of the script we make an ibase_close. If three users go to our site at the same page, the connect times are so: User 1: 0.180948s User 2: 1.104926s User 3: 2.055006s The times go very very high, if more users go to the site. The times go up to more than one or two minutes, only for a connect(!). We tried it with a ibase_pconnect, a persistent connection, too. But the times are the same like with ibase_connect. At the php.ini we have maked the following settings: a) no entry for ibase.allow_persistent b) ibase.allow_persistent = On c) ibase.allow_persistent = 1 For the number of connects we tried it with ibase.max_persistent = -1 ibase.max_links = -1 and with ibase.max_persistent = 100 ibase.max_links = 100 too. It makes no diffence. The parameter of the connects are always the same, the same database, the same user and so on. Know anybody, why the connect times go so high? Know anybody, does the persistent connect work like described? I hope, that anybody can help me and: thanks. Best regards, Ira -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Mandatory File Locking in PHP?
Hi, From the PHP manual I find that the flock() function does a advisory file locking. Is there a way to do mandatory file locking where we do strict locking? That is once a file is locked, no other process or thread is allowed to edit the file untill the lock owner is done with his job and he has removed the lock. Thanks, Ananth. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c
That makes PEAR installer coredump with the following core: Core was generated by `/data/src/php5/sapi/cli/php -n -dsafe_mode 0 /data/src/php5/pear/install-pear.php'. #0 0x08142d78 in _efree (ptr=0x400b396c, __zend_filename=0x81a89e0 /data/src/php5/Zend/zend_execute_API.c, __zend_lineno=332, __zend_orig_filename=0x81a95e0 /data/src/php5/Zend/zend_variables.c, __zend_orig_lineno=44) at /data/src/php5/Zend/zend_alloc.c:242 242 REMOVE_POINTER_FROM_LIST(p); (gdb) bt #0 0x08142d78 in _efree (ptr=0x400b396c, __zend_filename=0x81a89e0 /data/src/php5/Zend/zend_execute_API.c, __zend_lineno=332, __zend_orig_filename=0x81a95e0 /data/src/php5/Zend/zend_variables.c, __zend_orig_lineno=44) at /data/src/php5/Zend/zend_alloc.c:242 #1 0x08154de0 in _zval_dtor (zvalue=0x400b39a8, __zend_filename=0x81a89e0 /data/src/php5/Zend/zend_execute_API.c, __zend_lineno=332) at /data/src/php5/Zend/zend_variables.c:44 #2 0x0814c1f8 in _zval_ptr_dtor (zval_ptr=0x400b39f8, __zend_filename=0x81a95e0 /data/src/php5/Zend/zend_variables.c, __zend_lineno=164) at /data/src/php5/Zend/zend_execute_API.c:332 #3 0x08155077 in _zval_ptr_dtor_wrapper (zval_ptr=0x400b39f8) at /data/src/php5/Zend/zend_variables.c:164 #4 0x0815c18d in zend_hash_destroy (ht=0x400b33d4) at /data/src/php5/Zend/zend_hash.c:541 #5 0x0814ecef in destroy_zend_class (pce=0x81efa84) at /data/src/php5/Zend/zend_opcode.c:120 #6 0x0815c18d in zend_hash_destroy (ht=0x81c0984) at /data/src/php5/Zend/zend_hash.c:541 #7 0x0815613a in zend_shutdown () at /data/src/php5/Zend/zend.c:674 #8 0x081229eb in php_module_shutdown () at /data/src/php5/main/main.c:1346 #9 0x08172b97 in main (argc=7, argv=0xb9c4) at /data/src/php5/sapi/cli/php_cli.c:813 #10 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6 Edin - Original Message - From: Stanislav Malyshev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 29, 2003 3:33 PM Subject: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c stas Wed Jan 29 09:33:18 2003 EDT Modified files: /ZendEngine2 zend_execute_API.c Log: Fix object destructors: zend_objects_store_call_destructors is not used anymore, we rely on symbol tables cleaners to destroy all objects. Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.189 ZendEngine2/zend_execute_API.c:1.190 --- ZendEngine2/zend_execute_API.c:1.189 Thu Jan 23 00:15:42 2003 +++ ZendEngine2/zend_execute_API.c Wed Jan 29 09:33:18 2003 @@ -189,15 +189,23 @@ void shutdown_executor(TSRMLS_D) { zend_try { - zend_objects_store_call_destructors(EG(objects_store) TSRMLS_CC); - zend_ptr_stack_destroy(EG(arg_types_stack)); - - while (EG(symtable_cache_ptr)=EG(symtable_cache)) { + +/* Removed because this can not be safely done, e.g. in this situation: + Object 1 creates object 2 + Object 3 holds reference to object 2. + Now when 1 and 2 are destroyed, 3 can still access 2 in its destructor, with + very problematic results */ +/* zend_objects_store_call_destructors(EG(objects_store) TSRMLS_CC); */ + +/* Moved after symbol table cleaners, because some of the cleaners can call + destructors, which would use EG(symtable_cache_ptr) and thus leave leaks */ +/* while (EG(symtable_cache_ptr)=EG(symtable_cache)) { zend_hash_destroy(*EG(symtable_cache_ptr)); efree(*EG(symtable_cache_ptr)); EG(symtable_cache_ptr)--; } +*/ zend_llist_apply(zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC); zend_hash_destroy(EG(symbol_table)); @@ -217,6 +225,12 @@ } else { zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC); zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC); + } + + while (EG(symtable_cache_ptr)=EG(symtable_cache)) { + zend_hash_destroy(*EG(symtable_cache_ptr)); + efree(*EG(symtable_cache_ptr)); + EG(symtable_cache_ptr)--; } } zend_end_try(); -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c
EK That makes PEAR installer coredump with the following core: Doesn't happen to me. What were the arguments? -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ +972-3-6139665 ext.109 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c
EK That makes PEAR installer coredump with the following core: Doesn't happen to me. What were the arguments? You need to remove $PREFIX/lib/php to reproduce on my RedHat 7.3 box. ./configure --enable-debug make make install-pear Edin -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: Mandatory File Locking in PHP?
Try the direct I/O extension, specifically dio_fcntl(). Just make sure the filesystem you're using the locks on was mounted with -o mand, and the locks will be mandatory by default. J Ananth Kesari wrote: Hi, From the PHP manual I find that the flock() function does a advisory file locking. Is there a way to do mandatory file locking where we do strict locking? That is once a file is locked, no other process or thread is allowed to edit the file untill the lock owner is done with his job and he has removed the lock. Thanks, Ananth. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Mandatory File Locking in PHP?
Aside from this being on the wrong list (this should go to php-general), it's worth noting that mandatory locking support is pretty inconsistently implemented across most OSs. George On Wednesday, January 29, 2003, at 10:59 AM, J Smith wrote: Try the direct I/O extension, specifically dio_fcntl(). Just make sure the filesystem you're using the locks on was mounted with -o mand, and the locks will be mandatory by default. J Ananth Kesari wrote: Hi, From the PHP manual I find that the flock() function does a advisory file locking. Is there a way to do mandatory file locking where we do strict locking? That is once a file is locked, no other process or thread is allowed to edit the file untill the lock owner is done with his job and he has removed the lock. Thanks, Ananth. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] apache2 functions
Hello, Here at Johns Hopkins we use Apache+PHP to drive the user interface to our Hubble Space Telescope image archive. Using PHP has been one of the best decisions we have made. One of our new features is an mosaic image browser. In some cases a PHP script will run a custom command line program (via passthru) that reads FITS format images or manipulates them and then passes them to the client as PNG. These images are often greater than 4000x4000 and with floating point precision have a fairly large memory footprint. Our servers have sufficient memory but only if the httpd processes exit after serving such a request. The apache_child_terminate function http://www.php.net/manual/en/function.apache-child-terminate.php seems perfect for this application. Unfortunately, it doesn't seem to be implemented for Apache2 http://bugs.php.net/bug.php?id=17557. Other solutions such as setting MaxRequestsPerChild=1 have undesirable effects on performance when serving many smaller files. Does anyone know what the status of this bug is? I searched the list archives and could find any references to it. Thank you, Jon -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c
Should be fixed now. EK EK That makes PEAR installer coredump with the following core: EK EK Doesn't happen to me. What were the arguments? EK EK You need to remove $PREFIX/lib/php to reproduce on my RedHat 7.3 EK box. EK EK ./configure --enable-debug make make install-pear EK EK Edin EK -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ +972-3-6139665 ext.109 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] apache2 functions
For this case, could you just consider running PHP as a CGI? That would leave Apache up but let PHP close down after execution, yes? Dante -- D. Dante Lorenso Web Adminstrator [EMAIL PROTECTED] -Original Message- From: William Jon McCann [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 11:08 AM To: [EMAIL PROTECTED] Subject: [PHP-DEV] apache2 functions Hello, Here at Johns Hopkins we use Apache+PHP to drive the user interface to our Hubble Space Telescope image archive. Using PHP has been one of the best decisions we have made. One of our new features is an mosaic image browser. In some cases a PHP script will run a custom command line program (via passthru) that reads FITS format images or manipulates them and then passes them to the client as PNG. These images are often greater than 4000x4000 and with floating point precision have a fairly large memory footprint. Our servers have sufficient memory but only if the httpd processes exit after serving such a request. The apache_child_terminate function http://www.php.net/manual/en/function.apache-child-terminate.php seems perfect for this application. Unfortunately, it doesn't seem to be implemented for Apache2 http://bugs.php.net/bug.php?id=17557. Other solutions such as setting MaxRequestsPerChild=1 have undesirable effects on performance when serving many smaller files. Does anyone know what the status of this bug is? I searched the list archives and could find any references to it. Thank you, Jon -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
This feature request (which seems worth doing) has sat on the back burner awhile. Probably because, in the words of one commenter, those who can produce the patch are just using regex instead. I've got an implementation put together, the patch for which can be viewed at: http://169.229.139.97/test/str_ireplace.diff.txt Ilia has already voiced a -1 on IRC, but since many php-dev folks have voiced +1s in the bug comment I'd like to open a dialog. Comments? -Pollita -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] CVS Account Request: josx
Translating the php-gtk documentation to spanish -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
I've got an implementation put together, the patch for which can be viewed at: http://169.229.139.97/test/str_ireplace.diff.txt After some comments on IRC, here's an alternate version to the above patch. This second approach avoids creating php_memnstri by simply searching through a copy of haystack which is strtolowered against a strtolowered version of needle (no need to copy that part). http://169.229.139.97/test/str_ireplace.diff-2.txt Should be quicker and cleaner at the cost of a small malloc in the estrndup call. -Pollita -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version ofstr_replace()
On Wed, 29 Jan 2003, Sara Golemon wrote: I've got an implementation put together, the patch for which can be viewed at: http://169.229.139.97/test/str_ireplace.diff.txt After some comments on IRC, here's an alternate version to the above patch. This second approach avoids creating php_memnstri by simply searching through a copy of haystack which is strtolowered against a strtolowered version of needle (no need to copy that part). http://169.229.139.97/test/str_ireplace.diff-2.txt Should be quicker and cleaner at the cost of a small malloc in the estrndup call. I still don;t see no real use for this function, you can easily do this with eregi_replace() or preg_replace(). Derick -- - Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ - -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
Derick Rethans wrote: On Wed, 29 Jan 2003, Sara Golemon wrote: I've got an implementation put together, the patch for which can be viewed at: http://169.229.139.97/test/str_ireplace.diff.txt After some comments on IRC, here's an alternate version to the above patch. This second approach avoids creating php_memnstri by simply searching through a copy of haystack which is strtolowered against a strtolowered version of needle (no need to copy that part). http://169.229.139.97/test/str_ireplace.diff-2.txt Should be quicker and cleaner at the cost of a small malloc in the estrndup call. I still don;t see no real use for this function, you can easily do this with eregi_replace() or preg_replace(). Derick I may be wrong since I haven't profiled this, but my understanding is that str_replace is much faster than doing either of the regex replacements. For that reason alone, there is a use for it. Shane -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
I may be wrong since I haven't profiled this, but my understanding is that str_replace is much faster than doing either of the regex replacements. For that reason alone, there is a use for it. Normally it would be quite faster, however once case sensitivity is added to the mix I believe the speed difference would be minimal. I've done some benchmarks and the speed difference between str_replace() and preg_replace() is only about 1/2 second in across 10 executions (5 replaces per instance). Another .6 of a second is added when preg_replace() is used with 'i' flag which makes it case insensitive. I have not benchmarked the stri_replace code but I imagine it would be in the same ballpark, meaning that we are adding a fairly large chunk of code for performance benefit of a 1 microsecond (1 millionth of a second) per instance. Ilia -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
I may be wrong since I haven't profiled this, but my understanding is that str_replace is much faster than doing either of the regex replacements. For that reason alone, there is a use for it. Normally it would be quite faster, however once case sensitivity is added to the mix I believe the speed difference would be minimal. I don't even see the speed difference as an issue as much as (A) simplicity for the user who hasn't figured out regex yet, (B) consistency (we have 'i' versions of most other string functions, why not this one?) The parameter accepting still needs to be fixed though, I copied most of the str_ireplace code from str_replace and forgot to clean that section up and make it nicer. I'll save that for *if* a quorum can be reached to include it at all. On a related topic, the 'boyer' option of str_replace isn't even documented. That alternate method of performing str_replaces look like it's a bit more efficient (no benchmarkes atm) but I'm wondering if there's a specific reasons why it wasn't documented yet. -Pollita -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version ofstr_replace()
I suggest to check out http://citeseer.nj.nec.com/navarro01fast.html The presented BNDM algorithm is one of the fastest string searching algorithm while being easy to implement. Its main loop is faster than the naive str_replace implementation(*). Check out a C test implementation: http://www.mail-archive.com/dev@httpd.apache.org/msg00939.html The above paper also discusses extending the algorithm to cover character classes (case insensitivity). (*) I had incorporated it into PHP, if I had found a way to nicely offset the compilation step. This proved to be the major obstacle for small sets. - Sascha -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version ofstr_replace()
On a related topic, the 'boyer' option of str_replace isn't even documented. That alternate method of performing str_replaces look like it's a bit more efficient (no benchmarkes atm) but I'm wondering if there's a specific reasons why it wasn't documented yet. The BM algorithm is outdated and can savely be dropped. - Sascha -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
Ilia A. wrote: I may be wrong since I haven't profiled this, but my understanding is that str_replace is much faster than doing either of the regex replacements. For that reason alone, there is a use for it. Normally it would be quite faster, however once case sensitivity is added to the mix I believe the speed difference would be minimal. I've done some benchmarks and the speed difference between str_replace() and preg_replace() is only about 1/2 second in across 10 executions (5 replaces per instance). Another .6 of a second is added when preg_replace() is used with 'i' flag which makes it case insensitive. I have not benchmarked the stri_replace code but I imagine it would be in the same ballpark, meaning that we are adding a fairly large chunk of code for performance benefit of a 1 microsecond (1 millionth of a second) per instance. Ilia What's the benchmark code? How is the benchmark difference on large text (ie. 100K of text) vs. small text (1K or smaller)? Shane -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()]
whoops, missent just to sascha instead of list... On a related topic, the 'boyer' option of str_replace isn't even documented. That alternate method of performing str_replaces look like it's a bit more efficient (no benchmarkes atm) but I'm wondering if there's a specific reasons why it wasn't documented yet. The BM algorithm is outdated and can savely be dropped. - Sascha That simplifies implementation then :) Here's a patch that takes out the boyer implementation and cleans up the parameter accepting in both str_replace and str_ireplace. It also avoids the _ex business since replace_in_subject is a static method which is only called by str_replace str_ireplace anyway. I also reduced php_str_to_str back to a single implementation by passing the case_sensitivity parameter to it, but since it's a PHPAPI function I also renamed it *_ex and created a passthrough for BC. http://169.229.139.97/test/str_ireplace.diff-3.txt The large chunk of added code is getting diminishingly smaller... though I suppose str_replace and str_ireplace could be turned into passthrough wrappers for a unified version, but that's probably going further than necessary. -Pollita -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version ofstr_replace()
I'd tip my hat towards implementing it. Pollita has a good point on consistency and for those who don't know regex's. On Wed, 29 Jan 2003, Sara Golemon wrote: I may be wrong since I haven't profiled this, but my understanding is that str_replace is much faster than doing either of the regex replacements. For that reason alone, there is a use for it. Normally it would be quite faster, however once case sensitivity is added to the mix I believe the speed difference would be minimal. I don't even see the speed difference as an issue as much as (A) simplicity for the user who hasn't figured out regex yet, (B) consistency (we have 'i' versions of most other string functions, why not this one?) The parameter accepting still needs to be fixed though, I copied most of the str_ireplace code from str_replace and forgot to clean that section up and make it nicer. I'll save that for *if* a quorum can be reached to include it at all. On a related topic, the 'boyer' option of str_replace isn't even documented. That alternate method of performing str_replaces look like it's a bit more efficient (no benchmarkes atm) but I'm wondering if there's a specific reasons why it wasn't documented yet. -Pollita --- Dan KalowskyI'll walk a thousand miles just http://www.deadmime.org/~dankto slip this skin. [EMAIL PROTECTED]- Streets of Philadelphia, [EMAIL PROTECTED]Bruce Springsteen -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
On Thu, 30 Jan 2003 06:48, Ilia A. wrote: I may be wrong since I haven't profiled this, but my understanding is that str_replace is much faster than doing either of the regex replacements. For that reason alone, there is a use for it. Normally it would be quite faster, however once case sensitivity is added to the mix I believe the speed difference would be minimal. I've done some benchmarks and the speed difference between str_replace() and preg_replace() is only about 1/2 second in across 10 executions (5 replaces per instance). Another .6 of a second is added when preg_replace() is used with 'i' flag which makes it case insensitive. I have not benchmarked the stri_replace code but I imagine it would be in the same ballpark, meaning that we are adding a fairly large chunk of code for performance benefit of a 1 microsecond (1 millionth of a second) per instance. Ilia Lies, damn lies and statistics. You say the difference is only 1/2 second accross 10 executions, but that means nothing unless you put it in context of how long the 10 executions took. 1/2 second could mean 90% difference or 1% differene. I wrote a very unscientific script to do a simple benchmark ?php include('stopwatch.inc'); $SW = new StopWatch; for ($i=0;$i50;$i++) str_replace('abcdefgh', 'def', 'fkjdals;fjdsakl;fjdsakl;fjdskl;fadabcdefghfdsafdsafdsa'); $SW-Stop(); for ($i=0;$i50;$i++) preg_replace('/abcdefgh/', 'def', 'fkjdals;fjdsakl;fjdsakl;fjdskl;fadabcdefghfdsafdsafdsa'); $SW-Stop(); ? I did quite a few runs and picked the upper and lower end of the results to paste here Biggest difference Total Time: 00:00:03.00 Total Time: 00:00:08.90 Smallest difference Total Time: 00:00:03.12 Total Time: 00:00:06.94 Bearing in mind this is on a pre-working-hours quad hyperthreaded 1.4ghz xeon box. So I've got a cpu just about all to myself here. Regards, Stephen Thorne. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
Gah. I botched that, I didn't reset the timer. Total Time: 00:00:03.08 //str_replace Total Time: 00:00:04.32 //preg_replace Total Time: 00:00:03.05 //str_replace Total Time: 00:00:03.67 //preg_replace Total Time: 00:00:03.27 //str_replace Total Time: 00:00:04.40 //preg_replace Closer than I thought. Probably deserves a better comparison tho. From these results I'll probably stop yelling at people for using preg_replace when str_replace will do. Regards Stephen Thorne. On Thu, 30 Jan 2003 08:50, Stephen Thorne wrote: On Thu, 30 Jan 2003 06:48, Ilia A. wrote: I may be wrong since I haven't profiled this, but my understanding is that str_replace is much faster than doing either of the regex replacements. For that reason alone, there is a use for it. Normally it would be quite faster, however once case sensitivity is added to the mix I believe the speed difference would be minimal. I've done some benchmarks and the speed difference between str_replace() and preg_replace() is only about 1/2 second in across 10 executions (5 replaces per instance). Another .6 of a second is added when preg_replace() is used with 'i' flag which makes it case insensitive. I have not benchmarked the stri_replace code but I imagine it would be in the same ballpark, meaning that we are adding a fairly large chunk of code for performance benefit of a 1 microsecond (1 millionth of a second) per instance. Ilia Lies, damn lies and statistics. You say the difference is only 1/2 second accross 10 executions, but that means nothing unless you put it in context of how long the 10 executions took. 1/2 second could mean 90% difference or 1% differene. I wrote a very unscientific script to do a simple benchmark ?php include('stopwatch.inc'); $SW = new StopWatch; for ($i=0;$i50;$i++) str_replace('abcdefgh', 'def', 'fkjdals;fjdsakl;fjdsakl;fjdskl;fadabcdefghfdsafdsafdsa'); $SW-Stop(); for ($i=0;$i50;$i++) preg_replace('/abcdefgh/', 'def', 'fkjdals;fjdsakl;fjdsakl;fjdskl;fadabcdefghfdsafdsafdsa'); $SW-Stop(); ? I did quite a few runs and picked the upper and lower end of the results to paste here Biggest difference Total Time: 00:00:03.00 Total Time: 00:00:08.90 Smallest difference Total Time: 00:00:03.12 Total Time: 00:00:06.94 Bearing in mind this is on a pre-working-hours quad hyperthreaded 1.4ghz xeon box. So I've got a cpu just about all to myself here. Regards, Stephen Thorne. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
On January 29, 2003 04:35 pm, Shane Caraveo wrote: What's the benchmark code? How is the benchmark difference on large text (ie. 100K of text) vs. small text (1K or smaller)? Attached is the benchmark script that I've used. I've intentionally used 'small' strings, since that is what I imagine is most common usage of the function. Ilia ?php $input[] = array('hfdhffndfafjdfjasfjas;fjdas;fjdsafjas;fjas', 'das', '1234'); $input[] = array('Used the form above or our advanced search page to make sure nobody has reported the bug already.', 'or', 'OR'); $input[] = array('Once you\'ve double-checked that the bug you\'ve found hasn\'t already been reported, and that you have collected all the information you need to file an excellent bug report, you can do so on our bug reporting page.', 'XYS', '1234'); $input[] = array('dfkfjgjdsgjdgfd', 'dfkfjgjdsgjdgfd', '13243'); $input[] = array('xif pleh ot tnaw lliw enoemos taht gub a troper ot woh no spit ruo daeR', 'Read our tips on how to report a bug that someone will want to help fix', '13243'); function getmicrotime() { list($usec, $sec) = explode( ,microtime()); return ((float)$usec + (float)$sec); } $start = getmicrotime(); for ($i = 0; $i 10; $i++) { foreach($input as $ent) { str_replace($ent[1], $ent[2], $ent[0]); } } $end = getmicrotime(); echo str_replace took: .($end - $start).\n; foreach($input as $key = $val) { $input[$key][1] = '!' . $val[1] . '!'; } $start = getmicrotime(); for ($i = 0; $i 10; $i++) { foreach($input as $ent) { preg_replace($ent[1], $ent[2], $ent[0]); } } $end = getmicrotime(); echo preg_replace took: .($end - $start).\n; foreach($input as $key = $val) { $input[$key][1] .= 'i'; } $start = getmicrotime(); for ($i = 0; $i 10; $i++) { foreach($input as $ent) { preg_replace($ent[1], $ent[2], $ent[0]); } } $end = getmicrotime(); echo preg_replace(i) took: .($end - $start).\n; ? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
On Thu, 30 Jan 2003 09:09, Ilia A. wrote: On January 29, 2003 04:35 pm, Shane Caraveo wrote: What's the benchmark code? How is the benchmark difference on large text (ie. 100K of text) vs. small text (1K or smaller)? Attached is the benchmark script that I've used. I've intentionally used 'small' strings, since that is what I imagine is most common usage of the function. Ilia Large html files might be another good test. As I've often seen crude template created with str_replace. I'm having fun actually getting round to investigating this. I've always just believed what the manual says if you don't need the power of regex, use str_replace instead. I wonder if we should include ereg in our benchmarks too.. Regards Stephen Thorne. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Why i believe we need final
At 09:46 29.01.2003, Stanislav Malyshev wrote: MB Sure it cannot because insert cannot. The problem and the error you did MB above is that you split an operation into two. Your real operation is MB insert_with_password and that is different from insert. Again insert is an That's the whole point of OO - to allow overloading the same operation, so even classes that do not know about implementation details could use it. MB as a member and not as a base class. Maybe it is now a good thing to MB have a generalised container interface and declare insert in the container MB implementations final. Highly specialised containers would then inheritd I do not see why should container interface be final. MB A class that is derived from a concrete container may in some container MB implementations have final functions. For example whatever inherits a fifo Still have no explanation why anyone would need it. Just to disallow overriding because we can? I see no added value in that. MB If you have another insert implementation in a class than you MB missused inheritance. If the operation is different than your derived MB class is no for example no longer a fifo. Instead it uses a fifo. Implementation can be different and still be a fifo. That depends on overriding implementation. Again, I still have yet to see any example where the proposed 'final' plays substantial role and not just is there because 'maybe someone might want to use it'. Hey YOU are the example you are looking for. Think i earn money by designing class and data models and in that i know that i cannot modell the world and as a result i create modells which are no all-in-one devices suitable for everything (german: eier-legende-wollmilchsau) and even capable of beeing missused for that by inheritance. And at those points where i know of the simplications and restrictions and compromises i made i *may* decide a function to be final. If you want real life examples (and surely it seems you will never trust me) get yourself a book from scott meyers (going to my bookshelf) effective c++ and more effective C++ and read something about programmingand remeber C++ has no final it only has virtual and non virtual (and it also has abstract with default implementation (the other discussion where i said is possible and valuable to think about)). If you don't like C++ get you a theory book or any good book about another language(written by someone who has understood OOP). Sorry but i guess the discussion does not make any more sense. marcus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Mandatory File Locking in PHP?
At 18:07 29.01.2003, George Schlossnagle wrote: Aside from this being on the wrong list (this should go to php-general), it's worth noting that mandatory locking support is pretty inconsistently implemented across most OSs. Why wrong list? I guess Ananth needs it somewhere forthe netware port of php... In dba extension i use that mechanism to hinder multiple php instances to update the same database file. Wez and me will move that code or whatever solution to the streams stuff. Inside dba i use flock compatibility routines. If you can show us how to do that on Netware or if you can use those mechanisms then both (streams and netware port) would benefit. marcus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
better and better... Ilia offered up an optimized version of php_str_to_str which skips string resizing and handles do-no-work scenarios up front. I've made necessary changes to make this case_optional and made a new patch: http://169.229.139.97/test/str_ireplace.diff-4.txt as well as posting what the resulting string.c looks like: http://169.229.139.97/test/string-4.c Yes the patch is getting larger, but the resulting codebase is shrinking... -Pollita -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
I don't even see the speed difference as an issue as much as (A) simplicity for the user who hasn't figured out regex yet, (B) consistency (we have 'i' versions of most other string functions, why not this one?) +1 for the reasons stated above. Edin -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
At 00:47 30.01.2003, Edin Kadribasic wrote: I don't even see the speed difference as an issue as much as (A) simplicity for the user who hasn't figured out regex yet, (B) consistency (we have 'i' versions of most other string functions, why not this one?) +1 for the reasons stated above. +1 (It is not so important if we know how to emulate this one. It's about our usesers..we should not leave the focus on the users.) marcus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Mandatory File Locking in PHP?
The real question is why you need mandatory locks and not advisory locks. If everyone is playing on the same team, advisory locks should provide all the semantics you need (and are very portable). Mandatory locks (on linux at least) require not only special mount options, but special perms to the file (g-x, g+s, I believe). That seems like a lot to require inside an extension. The dba solution so far is based on flock() and where not appropriate use fctnl(). I tried to have the lock stuff working on as many systems as possible. marcus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()
better and better... One last optimization to save memcpys when needle_len == str_len (thanks again ilia): Actual Patch: http://169.229.139.97/test/str_ireplace.diff-5.txt Resultant string.c for easy reading: http://169.229.139.97/test/string-5.c I've heard enough Ayes over Nays (here, in bugs.php.net, and in IRC) to say this should go in. I'm on my way home now, If I havn't heard a showstopper in the next 4-5 hours, I'll go ahead and apply it. -Pollita -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Feature Request #5919 case-insensitive version ofstr_replace()
One last optimization to save memcpys when needle_len == str_len (thanks again ilia): Actual Patch: http://169.229.139.97/test/str_ireplace.diff-5.txt Resultant string.c for easy reading: http://169.229.139.97/test/string-5.c I've heard enough Ayes over Nays (here, in bugs.php.net, and in IRC) to say this should go in. Well, actually, I would prefer to see a proper BNDM implementation in the tree. - character classes are handled for free (i.e. a case insensitive search does not take longer) - combining shift-and and automata is much faster than our current naive algorithm (I may say so, I wrote it years ago) - allows us to combine multiple patterns into one search (I have not studied that part of the paper yet). This would enable us to optimize the case where you pass arrays to str_replace. Instead of scanning the haystack one time per replacement text, we would scan it only once. - Sascha -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: Mandatory File Locking in PHP?
On Wednesday, January 29, 2003, at 07:11 PM, Marcus Börger wrote: The real question is why you need mandatory locks and not advisory locks. If everyone is playing on the same team, advisory locks should provide all the semantics you need (and are very portable). Mandatory locks (on linux at least) require not only special mount options, but special perms to the file (g-x, g+s, I believe). That seems like a lot to require inside an extension. The dba solution so far is based on flock() and where not appropriate use fctnl(). I tried to have the lock stuff working on as many systems as possible. Right. Both of these are pretty portable, one being present on all BSD-style systems and the other on POSIX systems. They are also advisory locks. Mandatory locks actually prevent read and write calls from _anyone_ else succeeding on that file. On linux, mandatory locks are set with fcntl, but it's not part of the standard POSIX standard. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Can't build xslt/sablot
/usr/local/lib/libsablot.so: undefined reference to `operator new[](unsigned)' /usr/local/lib/libsablot.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info' /usr/local/lib/libsablot.so: undefined reference to `operator delete(void*)' /usr/local/lib/libsablot.so: undefined reference to `__gxx_personality_v0' /usr/local/lib/libsablot.so: undefined reference to `__cxa_pure_virtual' /usr/local/lib/libsablot.so: undefined reference to `vtable for __cxxabiv1::__class_type_info' /usr/local/lib/libsablot.so: undefined reference to `operator delete[](void*)' /usr/local/lib/libsablot.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info' /usr/local/lib/libsablot.so: undefined reference to `operator new(unsigned)' collect2: ld returned 1 exit status make: *** [sapi/cgi/php] Error 1 -- Sebastian Bergmann http://sebastian-bergmann.de/ http://phpOpenTracker.de/ Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php