Bug 163490
| Summary: | PEAR::DB autoExecute function does not work when updating with WHERE clause | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 3 | Reporter: | Christian Rose <menthos> | ||||
| Component: | php | Assignee: | Joe Orton <jorton> | ||||
| Status: | CLOSED ERRATA | QA Contact: | David Lawrence <dkl> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 3.0 | CC: | tao | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | RHSA-2006-0276 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2006-04-25 14:27:22 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 170417 | ||||||
| Attachments: |
|
||||||
Created attachment 116861 [details]
Patch that fixes the problem in PEAR::DB
Thanks for the report and for finding the patch. This problem appears to still be present in php-4.3.2-25.ent. This problem appears to still be present in php-4.3.2-26.ent. An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2006-0276.html CRM closed, closing this Internal Status set to 'Resolved' Status set to: Closed by Tech Resolution set to: 'Auto Closed' This event sent from IssueTracker by pdemauro issue 83190 |
Description of problem: The current php package in RHEL 3 includes version 1.3 of the PEAR DB package. That version has a problem that will be triggered in some cases, for example when using the PEAR::DB autoExecute() function for updating a row in a table by using a WHERE clause. Consider the following example MySQL table: CREATE TABLE `products` ( `id` int(11) NOT NULL auto_increment, `name` varchar(32) NOT NULL default '', `price` double NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=4 ; INSERT INTO `products` VALUES (1, 'banana', 1); INSERT INTO `products` VALUES (2, 'apple', 0.5); INSERT INTO `products` VALUES (3, 'pear', 0.7); Consider the following example PHP code (a valid $db object is assumed): $result = $db->autoExecute('products', array('id' => 2, 'name' => 'sweetapple', 'price' => '1.42'), DB_AUTOQUERY_UPDATE, 'id = 2'); if (PEAR::isError($result)) { echo $result->getMessage() . "<br/>\n"; echo $result->getUserInfo() . "<br/>\n"; echo $result->getCode() . "<br/>\n"; } The above code will generate the following error output: DB Error: insufficient data supplied UPDATE products SET id = ?,name = ?,price = ? WHERE UPDATE products SET id = ?,name = ?,price = ? -20 This is because there is a simple and well-known[1] bug in the buildManipSQL() function in DB/common.php, which the attached patch fixes. With the attached patch applied, the SQL update code above executes without error. [1] http://marc.theaimsgroup.com/?l=pear-general&m=104326823101806&w=2 Version-Release number of selected component (if applicable): php-4.3.2-24.ent How reproducible: Every time.