#33333 [NEW]: strpos (and other functions) not seeing a character that is very clearly there
| From: | FxChiP at Gmail dot com | Date: | Tue, 14 Jun 2005 05:50:03 +0000 |
| Subject: | #33333 [NEW]: strpos (and other functions) not seeing a character that is very clearly there | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-80286@lists.php.net to get a copy of this message | ||
From: FxChiP at Gmail dot com
Operating system: *nix most likely
PHP version: 4.3.11
PHP Bug Type: Strings related
Bug description: strpos (and other functions) not seeing a character that is very clearly there
Description:
------------
Using explode(), strpos(), and probably any other string-related function
in conjunction with a string returned from fgets() will (at least
sometimes) produce an incorrect result.
i.e. if there is a line like this in a file called public_covers.db:
FxChiP§this is a test
statement§guitar§akczf.pk.gif§whee§1113865622§1113967262
The *entire string* will be the first element in the array created by
explode(). More information is included in the reproduce code.
Contents of the public_covers.db file:
FxChiP§this is a test
statement§guitar§akczf.pk.gif§whee§1113865622§1113967262
duality515§Vermilion
Pt2§bass§jimroot54_vermilionpt2.mp3§pwnage§1113877848§1113967262
duality515§Everything
Ends§guitar§macca_everythingends.mp3§w00t§1113967262§1113967262
duality515§gsg§bass§temp.jpg§§1116469075§1113967262
Reproduce code:
---------------
<?PHP
$public_db = fopen("public_covers.db", "r");
$bwerp = explode('§', fgets($public_db));
var_dump($bwerp);
?>
Expected result:
----------------
From the var_dump, I'd expect to see an array consisting of everything "in
between" the § characters.
Actual result:
--------------
array(1) { [0]=> string(84) "FxChiP§this is a test
statement§guitar§akczf.pk.gif§whee§1113865622§1113967262 " }
--
Edit bug report at http://bugs.php.net/?id=33333&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33333&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33333&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33333&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33333&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33333&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33333&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33333&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33333&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33333&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33333&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33333&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33333&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33333&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33333&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33333&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33333&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33333&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33333&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33333&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33333&r=mysqlcfg