|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-19 14:04 UTC] mj@php.net
[2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 10:00:01 2025 UTC |
Description: ------------ When subclassing PDO from different classes, all the classes become the last instantiated. This happens in the Debian etch packages (php5 5.2.0-8+etch1) and in CentOS release 4.4 (php5 5.2.0-10 built from fedora SRPM) Reproduce code: --------------- class CA extends PDO { public $a=1; public function __construct() { parent::__construct("mysql:dbname=dbname", "user", "password",array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'",PDO::ATTR_PERSISTENT => true)); } } class CB extends PDO { public $b=2; public function __construct() { parent::__construct("mysql:dbname=dbname", "user", "password",array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'",PDO::ATTR_PERSISTENT => true)); } } $a = new CA(); $b = new CB(); print_r($a); print_r($b); Expected result: ---------------- CA Object ( [a] => 1 ) CB Object ( [b] => 2 ) Actual result: -------------- CB Object ( [b] => 2 ) CB Object ( [b] => 2 )