Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #34203 : PHP crashes on PDO prepared query
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 11th April 01:45
php-bugs
External User
 
Posts: 1
Default #34203 : PHP crashes on PDO prepared query



From: stotty at tvnet dot hu
Operating system: Linux Fedora Core 4
PHP version: 5.1.0RC1
PHP Bug Type: PDO related
Bug description: PHP crashes on PDO prepared query

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


--
Edit bug report at http://bugs.php.net/?id=34203&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34203&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34203&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34203&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34203&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34203&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34203&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34203&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34203&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34203&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34203&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34203&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34203&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34203&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34203&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34203&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34203&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34203&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34203&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34203&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34203&r=mysqlcfg
  Reply With Quote


  sponsored links


2 11th April 11:46
External User
 
Posts: 1
Default #34203 : PHP crashes on PDO prepared query



ID: 34203
Updated by: sniper@php.net
Reported By: stotty at tvnet dot hu
-Status: Open
+Status: Assigned
Bug Type: PDO related
Operating System: Linux Fedora Core 4
PHP Version: 5.1.0RC1
-Assigned To:
+Assigned To: wez


Previous Comments:
------------------------------------------------------------------------

[2005-08-21 10:33:25] stotty at tvnet dot hu

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

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=34203&edit=1
  Reply With Quote
3 12th April 21:39
External User
 
Posts: 1
Default #34203 : PHP crashes on PDO prepared query


ID: 34203
Updated by: edink@php.net
Reported By: stotty at tvnet dot hu
-Status: Assigned
+Status: Closed
Bug Type: PDO related
Operating System: Linux Fedora Core 4
PHP Version: 5.1.0RC1
Assigned To: wez
New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

Thank you for the report, and for helping us make PHP better.


Previous Comments:
------------------------------------------------------------------------

[2005-08-21 10:33:25] stotty at tvnet dot hu

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

------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=34203&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666