#36613 [NEW]: array_slice Cannot Preserve Keys without Length
From: lists at zaunere dot com Operating system: Windows PHP version: 5.1.2 PHP Bug Type: Feature/Change Request Bug description: array_slice Cannot Preserve Keys without Length Description: The optional fourth parameter preserve_keys is only available if the third parameter length is also supplied. If the developer wishes to set preserve_keys to TRUE, he must also supply the length of the array he wishes to have returned, which may not be known. There is no way to indicate that length should remain optional - like passing NULL - while providing a value for preserve_keys. Reproduce code: --- $SomeArray = array('First','Middle','Last'); var_dump(array_slice($SomeArray,1,NULL,TRUE)); Expected result: array(2) { [1]=> string(6) "Middle" [2]=> string(4) "Last" } Actual result: -- array(0) { } -- Edit bug report at http://bugs.php.net/?id=36613&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36613&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36613&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36613&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36613&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36613&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36613&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=36613&r=needscript Try newer version:http://bugs.php.net/fix.php?id=36613&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36613&r=support Expected behavior:http://bugs.php.net/fix.php?id=36613&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36613&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36613&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36613&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36613&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36613&r=dst IIS Stability:http://bugs.php.net/fix.php?id=36613&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36613&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36613&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36613&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=36613&r=mysqlcfg
#35202 [Bgs->Opn]: errorCode() Returns String
ID: 35202 User updated by: lists at zaunere dot com Reported By: lists at zaunere dot com -Status: Bogus +Status: Open Bug Type: PDO related Operating System: Windows XP PHP Version: 5.1.0RC4 Assigned To: wez New Comment: The function prototypes in both of these locations is wrong: http://us2.php.net/manual/en/function.pdo-errorcode.php http://us2.php.net/manual/en/function.pdostatement-errorcode.php Integers are not returned as indicated in the documented function prototypes. Furthermore, there is some inconsistency in how '0' is returned. It would be expected that '0' is always returned, or that an invalid statement prepare would return an error. Code $pdo = new PDO('mysql:dbname=oet;host=localhost','me','you'); echo 'new pdo (good connection)=> '; var_dump($pdo->errorCode()); $stmt = $pdo->prepare('SELECT * FROM Valid'); echo ' stmt prepare (valid table)=> '; var_dump($stmt->errorCode()); $stmt->execute(); echo ' stmt execute (valid table)=> '; var_dump($stmt->errorCode()); $stmt1 = $pdo->prepare('SELECT * FROM Invalid'); echo 'stmt1 prepare (invalid table)=> '; var_dump($stmt1->errorCode()); $stmt1->execute(); echo 'stmt1 execute (invalid table)=> '; var_dump($stmt1->errorCode()); $stmt2 = $pdo->prepare('INVALID SQL'); echo ' stmt2 prepare (invalid SQL)=> '; var_dump($stmt2->errorCode()); $stmt2->execute(); echo ' stmt2 execute (invalid SQL)=> '; var_dump($stmt2->errorCode()); Output -- new pdo (good connection)=> string(5) "0" stmt prepare (valid table)=> string(0) "" stmt execute (valid table)=> string(5) "0" stmt1 prepare (invalid table)=> string(0) "" stmt1 execute (invalid table)=> string(5) "HY000" stmt2 prepare (invalid SQL)=> string(0) "" stmt2 execute (invalid SQL)=> string(5) "HY000" Only the execute() appears to set errorCode(), whereas the documents say "the last operation on the statement handle." Thanks, Hans Previous Comments: [2005-11-13 13:37:14] [EMAIL PROTECTED] errorCode() returns a SQLSTATE string, as documented. Use errorInfo() to obtain driver specific error information. [2005-11-12 20:13:41] [EMAIL PROTECTED] SQL error codes are strings [2005-11-12 20:11:20] lists at zaunere dot com Description: The errorCode() method of both the PDO and PDOStatement objects return a string, rather than an integer, as documented. If there is no error, they return an empty string. Reproduce code: --- $stmt = $MyPDO->prepare('SELECT * FROM MyTable'); var_dump($stmt->errorCode()); Expected result: int(0) Actual result: -- string(0) "" -- Edit this bug report at http://bugs.php.net/?id=35202&edit=1
#35202 [NEW]: errorCode() Returns String
From: lists at zaunere dot com Operating system: Windows XP PHP version: 5.1.0RC4 PHP Bug Type: PDO related Bug description: errorCode() Returns String Description: The errorCode() method of both the PDO and PDOStatement objects return a string, rather than an integer, as documented. If there is no error, they return an empty string. Reproduce code: --- $stmt = $MyPDO->prepare('SELECT * FROM MyTable'); var_dump($stmt->errorCode()); Expected result: int(0) Actual result: -- string(0) "" -- Edit bug report at http://bugs.php.net/?id=35202&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35202&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35202&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35202&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=35202&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=35202&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35202&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35202&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35202&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35202&r=support Expected behavior: http://bugs.php.net/fix.php?id=35202&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35202&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35202&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=35202&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35202&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=35202&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35202&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35202&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35202&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35202&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35202&r=mysqlcfg