From: Operating system: Apache/2.2.8 (Ubuntu) mod_python PHP version: 5.3.2 Package: PDO related Bug Type: Bug Bug description:PDOStatement clears output buffer and exits script
Description: ------------ I have upgraded recently to PHP 5.3.2 from www.dotdeb.org. My application is fully based on PDO. Before the upgrade everything worked fine, but after, when PDOStatement::execute() is called and there are binded values, the result is always a blank page in the browser. Even if there's some output before that call, it will be flushed and nothing will be returned. Also it exits the script without any error reporting. Note: Something that may be important: I also upgraded to MySQL 5.1.44-0.dotdeb.0, and I'm having another issue I still couldn't repair: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Anyway, I don't think it matters, because in the script below I'm connecting by TCP, so it should not be related to sockets... Test script: --------------- <?php $driver = 'mysql'; $host = 'hostname'; $user = 'username'; $schema = 'schemaname'; $password = 'userpassword'; $driver_options = array( PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'" ); $errors = PDO::ERRMODE_EXCEPTION; $db = new PDO("$driver:host=$host;dbname=$schema", $user, $password, $driver_options); $db->setAttribute(PDO::ATTR_ERRMODE, $errors); // Part A: This script fails $stmt = $db->prepare('SELECT * FROM detalles WHERE id < :id'); /* In the next line we are going to bind a value. This is what fails. * By the way, I tried using: * $stmt->bindParam(':id', $a = 15); * Also by using: * $stmt->execute(array(':id'=>15)); * * ... same result. */ $stmt->bindValue(':id', 15); echo 'This is some output that will never see the light'; // exit; // If you uncomment this line, the above output will see the light. $stmt->execute(); // Here script flushes the output buffer and exits with no errors. // End of part A. Comment it to activate part B. // Part B: This script works. The only difference is that we aren't binding anything $stmt = $db->prepare('SELECT * FROM detalles'); echo 'This is some output that will go out with no problem'; $stmt->execute(); var_dump($stmt->fetch()); // Displays the first record of `detalles` ?> Expected result: ---------------- I expect it to bind the values as always and keep on going... or at least trigger some error of any kind that gives me a clue of where am I failing... or even more, at least exiting the execution without clearing the previous output. This is very weird... Actual result: -------------- Part A of the previous script ouputs nothing... Part B outputs this: This is some output that will go out with no problem<pre class='xdebug-var-dump' dir='ltr'> <b>array</b> 'id' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'93'</font> <i>(length=2)</i> 0 <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'93'</font> <i>(length=2)</i> 'servicio' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'65'</font> <i>(length=2)</i> 1 <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'65'</font> <i>(length=2)</i> 'azafata' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'3175'</font> <i>(length=4)</i> 2 <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'3175'</font> <i>(length=4)</i> 'tipo' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'1'</font> <i>(length=1)</i> </pre> -- Edit bug report at http://bugs.php.net/bug.php?id=51429&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51429&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51429&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51429&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51429&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51429&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51429&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51429&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51429&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51429&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51429&r=support Expected behavior: http://bugs.php.net/fix.php?id=51429&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51429&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51429&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51429&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51429&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51429&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51429&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51429&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51429&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51429&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51429&r=mysqlcfg