Re: [PHP-DEV] strrchr() bugs

2004-06-17 Thread Derick Rethans
On Wed, 16 Jun 2004, Adam Maccabee Trachtenberg wrote: > On Wed, 16 Jun 2004, Hartmut Holzgraefe wrote: > > > > 1) strrpos('abcd', '') returns 4. Expected FALSE > > Although one could argue whether searching for empty > > strings makes sense at all the result is not completely > > wrong. There *is

Re: [PHP-DEV] strrchr() bugs

2004-06-16 Thread Adam Maccabee Trachtenberg
On Wed, 16 Jun 2004, Hartmut Holzgraefe wrote: > It should still find the *last* emtpy string, not the first, > shouldn't it? ;) Yup. I think we've now spent more time discussing this function than people have spent using it. :) -adam -- [EMAIL PROTECTED] author of o'reilly's php cookbook avoi

Re: [PHP-DEV] strrchr() bugs

2004-06-16 Thread Hartmut Holzgraefe
Ard Biesheuvel wrote: Hartmut Holzgraefe wrote: Adam Maccabee Trachtenberg wrote: Logically, it would probably be best to return 0 because that's where the first empty string occurs. this is strrchr(), not strchr() ;) Actually it's strrpos(), not str[r]chr() [look at Alexander's code], which _ha

Re: [PHP-DEV] strrchr() bugs

2004-06-16 Thread Ard Biesheuvel
Hartmut Holzgraefe wrote: Adam Maccabee Trachtenberg wrote: Logically, it would probably be best to return 0 because that's where the first empty string occurs. this is strrchr(), not strchr() ;) Actually it's strrpos(), not str[r]chr() [look at Alexander's code], which _has_ been rewritten in

Re: [PHP-DEV] strrchr() bugs

2004-06-16 Thread Hartmut Holzgraefe
Adam Maccabee Trachtenberg wrote: Logically, it would probably be best to return 0 because that's where the first empty string occurs. this is strrchr(), not strchr() ;) -- Hartmut Holzgraefe <[EMAIL PROTECTED]> -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http:

Re: [PHP-DEV] strrchr() bugs

2004-06-16 Thread Adam Maccabee Trachtenberg
On Wed, 16 Jun 2004, Hartmut Holzgraefe wrote: > > 1) strrpos('abcd', '') returns 4. Expected FALSE > Although one could argue whether searching for empty > strings makes sense at all the result is not completely > wrong. There *is* an empty string at the end of the haystack ... And at the beginn

Re: [PHP-DEV] strrchr() bugs

2004-06-16 Thread Hartmut Holzgraefe
Alexander Valyalkin wrote: Today I've revised strrchr() function in PHP4.3.7 sources. It wasn't binary-safe. For example: 1) strrpos('abcd', '') returns 4. Expected FALSE Although one could argue whether searching for empty strings makes sense at all the result is not completely wrong. There *is* a

[PHP-DEV] strrchr() bugs

2004-06-16 Thread Alexander Valyalkin
Today I've revised strrchr() function in PHP4.3.7 sources. It wasn't binary-safe. For example: 1) strrpos('abcd', '') returns 4. Expected FALSE 2) strrpos("a\0abcde", 'a') returns 6. Expected 2 3) strrpos("a\0bcde", "\0") returns 6. Expected 1 4) strrpos('', '\0') returns 0. Expected FALSE My versi