php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35932 PDO constructor failing on Windows 2000
Submitted: 2006-01-08 16:52 UTC Modified: 2006-01-11 20:07 UTC
From: j dot gizmo at aon dot at Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.1.1 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: j dot gizmo at aon dot at
New email:
PHP Version: OS:

 

 [2006-01-08 16:52 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-08 16:59 UTC] nlopess@php.net
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.
 [2006-01-08 17:00 UTC] j dot gizmo at aon dot at
In fact, I just found out that according to the online 
documentation, the syntax used in the docs is in fact correct.

However, the correct syntax does not work on PHP 5.1.1 on 
Win2K; so it is more a PDO related issue than documentation 
related.
 [2006-01-08 17:13 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-01-11 17:07 UTC] dbs@php.net
In addition to trying the latest release snapshot, please provide more information:

What PDO driver are you using?

What database (including version) are you connecting to?

What is the value of $dsn that you are passing to the PDO constructor?
 [2006-01-11 17:11 UTC] dbs@php.net
Changed summary to more accurately reflect bug report.
 [2006-01-11 19:53 UTC] j dot gizmo at aon dot at
I was trying to connect to SQLite version 3.
I tried different strings for $dsn, including:

"sqlite:test.db"
"sqlite::memory:"

I used only the drivers that came with PHP 5.1.1.
 [2006-01-11 20:07 UTC] j dot gizmo at aon dot at
I just checked the ini directives, and found out that 
zend.ze1_compatibility_mode was turned on. Turning it off 
caused the object to behave as expected.

I am sorry for any inconvenience I have caused.

Maybe the PDO object should throw a warning when it's cloned.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 13:01:29 2024 UTC