I’ve just discovered after two days of investigation that PDO doesn’t work when the [tt]zend.ze1_compatibility_mode[/tt] option is enabled, doing so will result in a fatal error:
Fatal error: Cannot clone object of class PDO due to 'zend.ze1_compatibility_mode' in /Users/webdev/Sites/MODx/pdo_test.php on line 24
The reason I thought I’d share this here is because this error will
not show up when trying to instantiate PDO within xPDO. All attempts left me with a blank screen in my browser. I finally narrowed it down to PDO when I created a test file that simply tried to create a PDO object. That’s when the error you see above came out.
The only solution I can find right now is in to use an ’&’ in the [tt]xpdo.connect.php[/tt] file like so:
Index: xpdo.connect.inc.php
===================================================================
--- xpdo.connect.inc.php (revision 160)
+++ xpdo.connect.inc.php (working copy)
@@ -10,9 +10,9 @@
* @package xpdo
*/
try {
- $this->pdo= new $pdo_classname($this->config['dsn'], $this->config['username'], $this->config['password'], $this->config['driverOptions']);
+ $this->pdo=& new $pdo_classname($this->config['dsn'], $this->config['username'], $this->config['password'], $this->config['driverOptions']);
$errorCode= $this->pdo->errorCode();
} catch (PDOException $xe) {
$this->pdo= null;
}
-return (is_object($this->pdo) && (empty($errorCode) || $errorCode == PDO_ERR_NONE));
\ No newline at end of file
+return (is_object($this->pdo) && (empty($errorCode) || $errorCode == PDO_ERR_NONE));
This will at least make the connection fail silently and continue execution. Anyone have any thoughts on this?