|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-06-14 08:45 UTC] rasmus@php.net
[2005-06-15 07:28 UTC] FxChiP at Gmail dot com
[2005-06-15 07:38 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 17:00:01 2025 UTC |
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 " }