Edit report at http://bugs.php.net/bug.php?id=51429&edit=1
ID: 51429 User updated by: yajodj at msn dot com Reported by: yajodj at msn dot com Summary: PDOStatement clears output buffer and exits script Status: Bogus Type: Bug Package: PDO related Operating System: Apache/2.2.8 (Ubuntu) mod_python PHP Version: 5.3.2 New Comment: Well, I downgraded succesfully to MySQL 5.0.51a-3ubuntu5.5. No socket errors anymore. Bug persists. Previous Comments: ------------------------------------------------------------------------ [2010-03-30 08:57:43] yajodj at msn dot com The socket problem doesn't appear in PHP but in another programs. As you can see in the example, I'm connecting through TCP. No sockets involved here. By the way, if it were a socket problem, part B wouldn't work either, and i suppose part A would throw some kind of error. Anyway, I'll try downgrading MySQL and I'll let you know the results. ------------------------------------------------------------------------ [2010-03-29 18:16:58] ras...@php.net This is a support question, not a bug report. Please go through appropriate support channels for that. And note that if you are getting a mysqld.sock error, you aren't actually going through tcp so that is your first clue. ------------------------------------------------------------------------ [2010-03-29 18:12:21] yajodj at msn dot com 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 this bug report at http://bugs.php.net/bug.php?id=51429&edit=1