note 60477 added to function.pdo-construct
| From: | j dot gizmo at aon dot at | Date: | Sun, 08 Jan 2006 13:27:04 +0000 |
| Subject: | note 60477 added to function.pdo-construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-101402@lists.php.net to get a copy of this message | ||
On Windows the sample code doesn't necessarily work. If you use
<?php
$db = new PDO("sqlite::memory:");
?>
you can get a 'No Error: Constructor not called' warning whenever you try any methods of
the $db object.
This is due to the fact that the PDO Object shouldn't be cloned (but still is cloneable). Using
the following syntax resolves the problem:
<?php
$db =& new PDO("sqlite::memory:");
?>
(Essentially, this assigns a reference of the newly created object to $db, not a copy; this way, the
$db object isn't cloned)
----
Manual Page -- http://www.php.net/manual/en/function.pdo-construct.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60477
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60477&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60477&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60477&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60477&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60477&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60477&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60477&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60477&report=yes
Search -- http://master.php.net/manage/user-notes.php