Bug #68417 [NEW]: PDO extending objects loose their attributes
From: wuttke at hd-system dot de
Operating system: Ubuntu 14.0.4.1 LTS
PHP version: Irrelevant
Package: PDO MySQL
Bug Type: Bug
Bug description:PDO extending objects loose their attributes
Description:
------------
A class that extends pdo uses a persistant mysql-connection.
Different objects of this class are constructed, but as soon as a
reference on one of these objects is reused, all of the objects that
exist at this moment loose their attributes.
Objects created after this procedure have their attributes.
Tested with php 5.9 and 5.18
Test script:
---------------
$o1 = new mysqlPDO('test_db', 'mydbserver.hds', 'root', '');
$o2 = new mysqlPDO('test_db', 'mydbserver.hds', 'root', '');
$o3 = new mysqlPDO('test_db', 'mydbserver.hds', 'root', '');
echo 'o1: '.$o1->attr.'<br>';
echo 'o2: '.$o2->attr.'<br>';
echo 'o3: '.$o3->attr.'<br>';
$o2 = new mysqlPDO('test_db', 'mydbserver.hds', 'root',
'');//At this
point, o1-o3 loose their attributes
echo 'o1: '.$o1->attr.'<br>';
echo 'o2: '.$o2->attr.'<br>';
echo 'o3: '.$o3->attr.'<br>';
$o4 = new mysqlPDO('test_db', 'mydbserver.hds', 'root',
'');//This one
has attributes again
echo 'o4: '.$o4->attr.'<br>';
Expected result:
----------------
o1: abc
o2: abc
o3: abc
o1: abc
o2: abc
o3: abc
o4: abc
Actual result:
--------------
o1: abc
o2: abc
o3: abc
o1:
o2:
o3:
o4: abc
--
Edit bug report at https://bugs.php.net/bug.php?id=68417&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68417&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68417&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68417&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68417&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68417&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68417&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68417&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68417&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68417&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68417&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68417&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68417&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68417&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68417&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68417&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68417&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68417&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68417&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68417&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68417&r=mysqlcfg
Thread (4 messages)
- wuttke at hd-system dot de