#35932 [Opn->Bgs]: PDO code samples
| From: | nlopess@php.net | Date: | Sun, 08 Jan 2006 15:59:16 +0000 |
| Subject: | #35932 [Opn->Bgs]: PDO code samples | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969371470@lists.php.net to get a copy of this message | ||
ID: 35932
Updated by: nlopess@php.net
Reported By: j dot gizmo at aon dot at
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: Windows 2000
PHP Version: Irrelevant
New Comment:
this is not a documentation problem surely. PHP 5 deprecates the use of
'=& new' syntax, as objects are always references.
Please try with latest PHP 5 version available and if the problem
persists, reopen this bug, but not as a documentation problem.
Previous Comments:
------------------------------------------------------------------------
[2006-01-08 16:52:48] j dot gizmo at aon dot at
Description:
------------
In code samples for the PDO object, objects are created with
the assignment operator (=) instead of the reference operator
(=&).
Reproduce code:
---------------
//Syntax used in code samples
$conn = new PDO( $dsn );
//How it actually works
$conn =& new PDO( $dsn );
Expected result:
----------------
The output shown below the corresponding code samples.
Actual result:
--------------
On windows, the first version doesn't report any errors,
however any subsequent calls to methods of $conn results in
the following warning: "SQL State [000000] No Error. PDO
Constructor was not called."
If you use the =& operator (and make $conn a reference to the
newly created object) everything works as expected.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35932&edit=1