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

Bug #11428 bool used as type of data in update autoExecute result in a freeze of script
Submitted: 2007-06-25 00:02 UTC
From: rapsys Assigned: quipo
Status: Closed Package: MDB2_Driver_mysqli (version 1.4.1)
PHP Version: 5.2.1 OS: Mandriva linux 2007.0
Roadmaps: (Not assigned)    
Subscription  


 [2007-06-25 00:02 UTC] rapsys (RaphaĆ«l Gertz)
Description: ------------ I discovered a bug in mysqli and update autoExecute. If a data type is set to bool, the MDB2_Statement_mysqli::_execute function will keep stuck at here : if (!@mysqli_stmt_execute($this->statement)) { File : MDB2/Driver/mysqli.php Version : 1.4.1 Line : 1572 In fact i discovered by context commenting, that this function should trigger an exception (which is hidden by @) about a passed MDB2_Error object Removing the bool type and puting integer instead fix the problem. See the test case below. ps : i am sorry but i am not enough skilled to fix that problem. Test script: --------------- <?php $sql_table<<<EOF CREATE TABLE `site_user` ( `id` bigint(20) NOT NULL auto_increment COMMENT 'The user id', `username` varchar(128) collate utf8_unicode_ci default NULL, `password` varchar(128) collate utf8_unicode_ci default NULL, `isdefault` tinyint(1) default NULL, `mail` varchar(128) collate utf8_unicode_ci default NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), KEY `password` (`password`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; INSERT INTO `site_user` (`id`, `username`, `password`, `isdefault`, `mail`) VALUES (4, 'guest', '.GuIEAoBpUNgo', NULL, 'guest@example.com'); EOF //Require once the Metabase DataBase abstraction layer 2 Pear class require_once 'MDB2.php'; require_once 'MDB2/Driver/mysqli.php'; require_once 'MDB2/Extended.php'; //MDB2 Data Source Name $dsn = array( 'phptype' => 'mysqli', 'hostspec' => 'localhost', 'username' => 'guest', 'password' => '.GuIEAoBpUNgo', 'database' => 'test', 'charset' => 'UTF8' ); //MDB2 options $options = array( 'debug' => 2, 'portability' => MDB2_PORTABILITY_ALL ); //Create the unique db object $db = MDB2::singleton($dsn, $options); //Clear the string unset($dsn, $options); //Load module Extended for getOne and getAll propriety $db->loadModule('Extended'); //Connect $ret = $db->connect(); if (MDB2::isError($ret)) //Trigger the error trigger_error($ret->getMessage(), E_USER_ERROR); /** * This execution will fail, in fact a MDB2_Error object is passed somewhere * The result is that an exception is triggered in this line : * if (!@mysqli_stmt_execute($this->statement)) { * In file : MDB2/Driver/mysqli.php line 1572 (version 1.4.1) * * The result is that this command (mysqli_stmt_execute) keep the process stuck at that step. * * In fact the problem come from the Types parameter, with 'integer' instead of 'bool' it will works... * * So i strongly suggest to fix mysqli to at least trigger a non-invisible error, or accept bool as a integer type... * * ps : .GuIEAoBpUNgo is ENCRYPT('guest') and is not used on my box at all */ $ret = $db->extended->autoExecute( //Table 'site_user', //Fields array( 'password' => '.GuIEAoBpUNgo', 'isdefault' => 1, 'mail' => 'guest@example.com' ), //Mode MDB2_AUTOQUERY_UPDATE, //Where 'id = '.$db->quote(4, 'integer'), //Types array('text', 'bool', 'text') ); //Check if error happen if (MDB2::isError($ret)) //Display the error trigger_error($ret->getMessage().$ret->getUserInfo(), E_USER_ERROR); echo 'toto'; Expected result: ---------------- toto

Comments

 [2007-06-30 11:13 UTC] quipo (Lorenzo Alberton)
The problem is that you're using an unsupported data type ("bool" instead of "boolean"), but the actual error wasn't propagated correctly. Fixed in CVS.