|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-09-04 02:20 UTC] edink@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 17 12:00:01 2025 UTC |
Description: ------------ If a prepared query with named parameters has one of the paramteres used more than once, then PHP fails with a realloc failure, without giving any useable error message. This bug triggers only if called from within a class member function Reproduce code: --------------- <?php $dsn='pgsql:dbname=xenophile host=localhost port=5432 user=stoty'; $dbc= new PDO($dsn); $dbc->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_EXCEPTION); class Crashme { public function crashfunction($one, $two) { global $dbc; $weight_check_stmt=$dbc->prepare(" select (select total_cpu_weight from domain0 where id= :domain0_id) - (select cpu_weight from domain_template where id= :template_id) - sum(cpu_weight) as result from domain where domain0_id = :domain0_id"); $weight_check_stmt->bindParam(":domain0_id", $one); $weight_check_stmt->bindParam(":template_id", $two); $weight_check_stmt->execute(); } } $crashclass = new Crashme; $crashclass->crashfunction(1,2); ?> Expected result: ---------------- I exepected to get a meaningfull error message, describing the problem, like I get when the above query is not run from a member function) (like in bug 33886) Actual result: -------------- I get this in the http error log: FATAL: erealloc(): Unable to allocate 4 bytes