Home » Database » DB » Bug #393
DB_storage::setup() warning on multi-columnar primary keys
Details
| Submitted | 2003-12-09 23:00 UTC |
|---|---|
| From | blake at mediafence dot com |
| Assigned | danielc |
| Status | Closed |
| Package | DB |
| PHP Version | Irrelevant |
| OS | all |
| Roadmaps | (Not assigned) |
Comments
[2003-12-09 23:00 UTC] blake at mediafence dot com
Description:
------------
The first line of DB_storage::setup() is a call to the database handler's quote() method:
$qval = $this->_dbh->quote($keyval);
This creates a warning if the $keyval parameter is an array. It appears that this call is unecessary since the _makeWhere() method immediately following this line quotes the key values one at a time. Not to mention that the value of $qval is not used in this method.
Recommendation:
remove the line or comment it out.
Reproduce code:
---------------
<?php
require_once( 'DB.php' );
require_once( 'DB/storage.php' );
$oDB = DB::Connect( 'mysql://blah:blah/blah, true );
$oEmpToDept = new DB_storage( 'EmployeesToDepartments', array( 'emp_id', 'dept_id' ), $oDB );
$oEmpToDept->setup( array( 1, 2 ) );
print( '<br>Employee-to-Department information: <br><br>' );
$oEmpToDept->dump();
$oDB->disconnect();
?>
Expected result:
----------------
no warnings, only output
Actual result:
--------------
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\temp\PEAR\php-4.3.4-Win32\pear\DB\mysql.php on line 654