From: tim_s_wiley at yahoo dot com Operating system: Windows 2008 PHP version: 5.3.20 Package: PDO related Bug Type: Bug Bug description:Storing PDO Statement Class in $_SESSION Corrupts all $_SESSION variables
Description: ------------ Anytime i assign a new object instance of PDOStatement to a session variable the session text file goes to zero byte and has no session information inside. The following code will produce the issue. If you comment out the 2nd $_SESSION assignment which is the PDO issue the session will log its information to the sess text file properly and works as expected. Here is very simple php example that will produce the issue: <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>PDO Statement Session Test</title> </head> <body> <?php $_SESSION['regularVariable'] = 'Regular Stuff'; // Works just fine $_SESSION['pdoVariable'] = new PDOStatement; // zeros the sess* file ?> </body> </html> Test script: --------------- <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>PDO Statement Session Test</title> </head> <body> <?php $_SESSION['regularVariable'] = 'Regular Stuff'; // Works just fine $_SESSION['pdoVariable'] = new PDOStatement; // zeros the sess* file ?> </body> </html> Expected result: ---------------- Test #1 - As is will produce a zero byte php sess* file(No variable information will be logged in the file and thus not available to follow-up sessions if there were session variables stored they are lost). Test #2 - Comment out the pdoVariable line will properly store the other $_SESSION variables in the sess* file. -- Edit bug report at https://bugs.php.net/bug.php?id=63969&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63969&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63969&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63969&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63969&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63969&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63969&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63969&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63969&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63969&r=support Expected behavior: https://bugs.php.net/fix.php?id=63969&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63969&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63969&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63969&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63969&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63969&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63969&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63969&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63969&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63969&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63969&r=mysqlcfg