Without words.
$ php -r 'var_dump(strpos("foo 11 bar", 11));'
int(4)
$ php --version
PHP 5.2.4-dev with Suhosin-Patch 0.9.6.2 (cli) (built: Oct 1 2007 14:16:42)
$ php -r 'var_dump(strpos("foo 11 bar", 11));'
bool(false)
$ php --version
PHP 5.2.5-pl1-gentoo with Suhosin-Patch 0.9.6.2 (cli) (built: Jan 9 2008 04:53:10)
Filed under PHP & nine comments & no trackbacks
Trackback specific URI for this entry
Lukas states:
published on January 22nd 2008, 02:48:14 pmHi,
As I said on IRC. It seems this behavior is unique to PHP 5.2.4 (at least 5.2.3 seems to behave just like 5.2.5), where it also did not match the documentation. I suggest you file a doc bug (ideally with patch) if there is no such bug report yet.
Reply
Lars Strojny responses:
published on January 22nd 2008, 03:14:58 pmOh, didn’t noticed the answer. Is this considered a regression or was it a bug fix in 5.2.5? I would guess the latter.
Reply
Lukas returns:
published on January 22nd 2008, 03:19:03 pmIt seems to be a fix in 5.2.5. There are a few points though:
1) I did not find anything in the changelog from a quick skim
2) Apparently there was not a test case to catch this regression before 5.2.4 was released
3) There should be a note in the strpos() docs
4) Potentially also in the upgrading guide
Feel free to fix 2)-4) with patches :)
Reply
steve supposes:
published on January 22nd 2008, 02:49:07 pmmuahaha
PS: geht man auf deine seite kommt ein alert von wegen, dass dein google-api-key auf eine andere webseite registriert ist
Reply
Lars Strojny opines:
published on January 22nd 2008, 03:35:53 pmWas the case on usrportage.net. Fixed that.
Reply
sapphirecat returns:
published on January 22nd 2008, 05:13:41 pmReply
aurelian opines:
published on January 23rd 2008, 07:48:08 pm$ php -r ‘var_dump(strpos("foo 11 bar", 11));’
bool(false)
$ php —version
PHP 5.3.0-dev (cli) (built: Jan 23 2008 20:43:09)
Reply
Lars Strojny responses:
published on January 24th 2008, 12:28:45 amOf course. The regression was in 5.2.4. A test to avoid this for the future is committed to php-src.
Reply
aurelian says:
published on January 24th 2008, 08:18:27 amSure,
You can also notice that my comment was added at 19:48 while I’m using a php version from the future (build timestamp is at 20:43).
My php has special powers then :)
Reply