Edit report at http://bugs.php.net/bug.php?id=52104&edit=1
ID: 52104 Updated by: [email protected] Reported by: daniel dot baulig at gmx dot de Summary: bindColumn creates Warning regardless of ATTR_ERRMODE settings -Status: Assigned +Status: Closed Type: Bug Package: PDO related Operating System: Windows 7 / Debian PHP Version: 5.3.2 -Assigned To: kalle +Assigned To: iliaa Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. 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. Previous Comments: ------------------------------------------------------------------------ [2011-06-01 15:23:28] [email protected] Automatic comment from SVN on behalf of iliaa Revision: http://svn.php.net/viewvc/?view=revision&revision=311711 Log: Fixed bug #52104 (bindColumn creates Warning regardless of ATTR_ERRMODE settings). ------------------------------------------------------------------------ [2010-06-18 08:43:54] daniel dot baulig at gmx dot de After thinking a bit about it I came to the conclusion this might be a feature, not a bug. If you are handed a PDOStatement from some other source (a library or a callee) you might not know which exact columns are in the result set. Because there also is no way to look them up you are stuck with "brute force" binding each column, that might be in that result set. If this would throw an Exception you would need to try { } catch ( PDOException $e ) { } every single bindColumn. While I do think this would be the correct approach from a design standpoint it is very clunky and cumbersome actually programming. If this method only issues a warning then you could simply @ supress that warning and try bindColumn on whatever you like. However, if this behaviour remains it should be documentet clearly in the PHP PDO manual, because it is not what you'd expect. ------------------------------------------------------------------------ [2010-06-18 04:50:55] [email protected] Ill have a look at this one and see if there is any others while looking ------------------------------------------------------------------------ [2010-06-16 23:12:59] daniel dot baulig at gmx dot de This code ofcourse resides in /ext/pdo/pdo_stmt.c ------------------------------------------------------------------------ [2010-06-16 23:07:37] daniel dot baulig at gmx dot de I looked into 5.3 SVN source code and was able to spot the problem. The following line is causing the Warning: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Did not found column name '%s' in the defined columns; it will not be bound", param->name); I believe it should be replaced by something like the following: pdo_raise_impl_error(stmt->dbh, stmt, "?????", "Did not found column name in the defined columns; it will not be bound" TSRMLS_CC); I also believe "Did not found column name" is not proper english and should either be "Did not find column name" or "Column name not found". I also do not know the exact meaning of the error codes used in other pdo_raise_impl_error like "HY093", so an appropriate errorcode for this error should be inserted instead of the question marks. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52104 -- Edit this bug report at http://bugs.php.net/bug.php?id=52104&edit=1
