From: z at szaboz dot com
Operating system: debian linux kernel 2.6
PHP version: 5.2.9
PHP Bug Type: Streams related
Bug description: stream_get_line
Description:
------------
this functions seems ignores the very first line starts with '#' sign
Reproduce code:
---------------
$fstr = fopen(myfile.txt,"r");
while(!feof($fstr)) {
$r[] = stream_get_line($fstr,400,"\n");
}
the myfile .txt:
#simple comment
default_size = 400
my_data = testdata
new_setup_dir = /root/master
#another comment
myIint = 45345
one_more_setup = value
this_variable = false
set_new_class = mycalss
Expected result:
----------------
array(13) {
[0]=>
string(0) "#simple comment"
[1]=>
string(0) ""
[2]=>
string(18) "default_size = 400"
[3]=>
string(18) "my_data = testdata"
[4]=>
string(28) "new_setup_dir = /root/master"
[5]=>
string(0) ""
[6]=>
string(16) "#another comment"
[7]=>
string(0) ""
[8]=>
string(15) "my_int = 45345"
[9]=>
string(24) "one_more_setup = value"
[10]=>
string(0) ""
[11]=>
string(21) "this_variable = false"
[12]=>
string(0) ""
[13]=>
string(23) "set_new_class = mycalss"
}
Actual result:
--------------
array(13) {
[0]=>
string(0) ""
[1]=>
string(18) "default_size = 400"
[2]=>
string(18) "my_data = testdata"
[3]=>
string(28) "new_setup_dir = /root/master"
[4]=>
string(0) ""
[5]=>
string(16) "#another comment"
[6]=>
string(0) ""
[7]=>
string(15) "my_int = 45345"
[8]=>
string(24) "one_more_setup = value"
[9]=>
string(0) ""
[10]=>
string(21) "this_variable = false"
[11]=>
string(0) ""
[12]=>
string(23) "set_new_class = mycalss"
}
--
Edit bug report at http://bugs.php.net/?id=47959&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47959&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47959&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47959&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47959&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47959&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47959&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47959&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47959&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47959&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47959&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47959&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47959&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47959&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47959&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47959&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47959&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47959&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47959&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47959&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47959&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47959&r=mysqlcfg