#33609 [Bgs]: function fgets returns error when optional parameter not passed
ID: 33609 User updated by: php at yvanrodrigues dot com Reported By: php at yvanrodrigues dot com Status: Bogus Bug Type: Filesystem function related Operating System: Windows 2000/XP PHP Version: 4.3.11 New Comment: damn, my mind must have been elsewhere when I wrote that line of code. Sorry for the crazy-talk Previous Comments: [2005-07-07 22:38:47] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php fread() & fgets() are 2 different functions. [2005-07-07 22:32:15] php at yvanrodrigues dot com Description: function fgets is documented as: string fgets ( resource handle [, int length] ) however if called with one argument it shows warning: Warning: Wrong parameter count for fread() in scriptname.php This has been reported in previous versions (eg bug 15480) and fixed. I suspect this snuck back in. The docs say the optional parameter has been in place since 4.2.0 I believe Reproduce code: --- for($a=0; !feof($fp); $a++) { $instring = fread($fp); $todayarray[$a] = array(); $todayarray[$a]['Course Code'] = trim(substr($instring, 0, 12)); $todayarray[$a]['Section'] = trim(substr($instring, 12, 13)); $todayarray[$a]['Cap'] = trim(substr($instring, 25, 4)); $todayarray[$a]['Enrollment'] = trim(substr($instring, 29, 4)); $todayarray[$a]['Professor'] = trim(substr($instring, 33)); break; } Expected result: I expect a string to be returned consisting of a line from the file starting at position 0 of the row and ending when the newline \r\n is reached. Actual result: -- php displays an error and dies -- Edit this bug report at http://bugs.php.net/?id=33609&edit=1
#33609 [NEW]: function fgets returns error when optional parameter not passed
From: php at yvanrodrigues dot com Operating system: Windows 2000/XP PHP version: 4.3.11 PHP Bug Type: Filesystem function related Bug description: function fgets returns error when optional parameter not passed Description: function fgets is documented as: string fgets ( resource handle [, int length] ) however if called with one argument it shows warning: Warning: Wrong parameter count for fread() in scriptname.php This has been reported in previous versions (eg bug 15480) and fixed. I suspect this snuck back in. The docs say the optional parameter has been in place since 4.2.0 I believe Reproduce code: --- for($a=0; !feof($fp); $a++) { $instring = fread($fp); $todayarray[$a] = array(); $todayarray[$a]['Course Code'] = trim(substr($instring, 0, 12)); $todayarray[$a]['Section'] = trim(substr($instring, 12, 13)); $todayarray[$a]['Cap'] = trim(substr($instring, 25, 4)); $todayarray[$a]['Enrollment'] = trim(substr($instring, 29, 4)); $todayarray[$a]['Professor'] = trim(substr($instring, 33)); break; } Expected result: I expect a string to be returned consisting of a line from the file starting at position 0 of the row and ending when the newline \r\n is reached. Actual result: -- php displays an error and dies -- Edit bug report at http://bugs.php.net/?id=33609&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33609&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33609&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33609&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33609&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33609&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33609&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33609&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33609&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33609&r=support Expected behavior: http://bugs.php.net/fix.php?id=33609&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33609&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33609&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33609&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33609&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33609&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33609&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33609&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33609&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33609&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33609&r=mysqlcfg
#31587 [Csd]: return value of mssql_query changed in 4.3.10, no longer returns accurate rslt.
ID: 31587 User updated by: php at yvanrodrigues dot com Reported By: php at yvanrodrigues dot com Status: Closed Bug Type: MSSQL related Operating System: Windows 2000/IIS 5.0/PHP 4.3.11 PHP Version: 4.3.10 New Comment: I will update my unix servers. How often are the Windows binaries updated? Thanks for the quick response. Previous Comments: [2005-01-17 22:57:45] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. [2005-01-17 22:11:36] php at yvanrodrigues dot com obviously that should read: if(mssql_query($sql) === false) { echo 'yikes!'; } [2005-01-17 21:27:49] php at yvanrodrigues dot com Description: Previous to 4.3.10, mssql_query returned the following: === a valid result set OR === true if successful but no result set OR === false if an error occurred Therefore if one wanted to check for an error one would use: if(mssql_query === false) { echo 'yikes!'; } Since 4.3.10, when using mssql_query to execute an INSERT query, a result of false is returned even if the row was successfully inserted. Reproduce code: --- $query = "INSERT INTO DOGBERT (CATBERT) VALUES ('DILBERT')"; $rs = mssql_query($query); if($rs === false) { echo 'This should only print when there is an error'; } Expected result: $rs should only evaluate === false when there is an error (according to the docs) Actual result: -- $rs always evaluates === false on INSERT -- Edit this bug report at http://bugs.php.net/?id=31587&edit=1
#31587 [NEW]: return value of mssql_query changed in 4.3.10, no longer returns accurate rslt.
From: php at yvanrodrigues dot com Operating system: Windows 2000/IIS 5.0/PHP 4.3.11 PHP version: 4.3.10 PHP Bug Type: MSSQL related Bug description: return value of mssql_query changed in 4.3.10, no longer returns accurate rslt. Description: Previous to 4.3.10, mssql_query returned the following: === a valid result set OR === true if successful but no result set OR === false if an error occurred Therefore if one wanted to check for an error one would use: if(mssql_query === false) { echo 'yikes!'; } Since 4.3.10, when using mssql_query to execute an INSERT query, a result of false is returned even if the row was successfully inserted. Reproduce code: --- $query = "INSERT INTO DOGBERT (CATBERT) VALUES ('DILBERT')"; $rs = mssql_query($query); if($rs === false) { echo 'This should only print when there is an error'; } Expected result: $rs should only evaluate === false when there is an error (according to the docs) Actual result: -- $rs always evaluates === false on INSERT -- Edit bug report at http://bugs.php.net/?id=31587&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31587&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31587&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31587&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=31587&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=31587&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31587&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31587&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31587&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31587&r=support Expected behavior: http://bugs.php.net/fix.php?id=31587&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31587&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31587&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=31587&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31587&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=31587&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31587&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31587&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31587&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31587&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31587&r=mysqlcfg
#31587 [Opn]: return value of mssql_query changed in 4.3.10, no longer returns accurate rslt.
ID: 31587 User updated by: php at yvanrodrigues dot com Reported By: php at yvanrodrigues dot com Status: Open Bug Type: MSSQL related Operating System: Windows 2000/IIS 5.0/PHP 4.3.11 PHP Version: 4.3.10 New Comment: obviously that should read: if(mssql_query($sql) === false) { echo 'yikes!'; } Previous Comments: [2005-01-17 21:27:49] php at yvanrodrigues dot com Description: Previous to 4.3.10, mssql_query returned the following: === a valid result set OR === true if successful but no result set OR === false if an error occurred Therefore if one wanted to check for an error one would use: if(mssql_query === false) { echo 'yikes!'; } Since 4.3.10, when using mssql_query to execute an INSERT query, a result of false is returned even if the row was successfully inserted. Reproduce code: --- $query = "INSERT INTO DOGBERT (CATBERT) VALUES ('DILBERT')"; $rs = mssql_query($query); if($rs === false) { echo 'This should only print when there is an error'; } Expected result: $rs should only evaluate === false when there is an error (according to the docs) Actual result: -- $rs always evaluates === false on INSERT -- Edit this bug report at http://bugs.php.net/?id=31587&edit=1