Home » Database » MDB2_Schema » Bug #8429
bad handling of tables named 'update'
Details
| Submitted | 2006-08-14 15:48 UTC |
|---|---|
| From | landrzejak at gmail dot com |
| Assigned | lsmith |
| Status | Closed |
| Package | MDB2_Schema |
| PHP Version | 5.1.4 |
| OS | linux2.6.17.8 |
| Roadmaps | (Not assigned) |
Comments
[2006-08-14 15:48 UTC] landrzejak at gmail dot com
Description:
------------
When issuing $foo->dumpDatabase ($foo being an instance of MDB2_Schema), a simple check of $database_definition is lacking, adding:
if (PEAR::isError($database_definition)) {
return $database_definition;
}
will resolve this.
Without it - in some cases the scripts will fail with a logged error:
PHP Fatal error: Cannot use object of type MDB2_Error as array in /foo/PEAR/lib/MDB2/Schema.php on line 1852
I came by this problem when trying do dump a database that contained a table named 'upgrade' under mysql 5.x. The reason was that 5.x has a (newly introduced in the late 4.1.19 - or so series) keyword 'upgrade' which conflicts with the tables name.
Regardless, this means that somewhere earlier the table name was not escaped properly.
Presumably the method that caused it was getDefinitionFromDatabase.
Test script:
---------------
The bug can be reproduced with the example.php script attached to the pear package of MDB2_Schema, when acting on a 5.0 series mysql database, using the mysqli extension.
Only other requirement is that the database contains a table named 'upgrade'. All dumps of such a table will fail.
Please attempt trying to dump a database into an example schema.xml file to see for yourself.