Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.6

Bug #8429 bad handling of tables named 'update'
Submitted: 2006-08-14 15:48 UTC
From: landrzejak at gmail dot com Assigned: lsmith
Status: Closed Package: MDB2_Schema (version 0.6.0)
PHP Version: 5.1.4 OS: linux2.6.17.8
Roadmaps: (Not assigned)    

 [2006-08-14 15:48 UTC] landrzejak at gmail dot com (Meltir)
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.


 [2006-08-14 17:22 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. You are calling the method with an improper parameter. So you need to fix that in your code. I have however noticed that in some places the identifiers are not quoted even if the "quote_identifier" option is set in the MDB2 instance. I have fixed that in CVS.