#28430 [Opn->Csd]: Cannot extend built-in classes (mysqli)
| From: | georg@php.net | Date: | Sat, 05 Jun 2004 18:34:39 +0000 |
| Subject: | #28430 [Opn->Csd]: Cannot extend built-in classes (mysqli) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60415@lists.php.net to get a copy of this message | ||
ID: 28430
Updated by: georg@php.net
Reported By: bert at procurios dot nl
-Status: Open
+Status: Closed
Bug Type: MySQL related
Operating System: *
PHP Version: 5.0.0RC2
Assigned To: georg
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-05-21 18:31:01] helly@php.net
The classes in mysqli either need to be final or they need to be made
extendable.
------------------------------------------------------------------------
[2004-05-21 18:25:35] helly@php.net
some of the internal classas cannot be extended and unfortunatley they
are not marked as 'final' right now. For you that means you need to
extend it by a proxy class that reimplements the original class
protocol and uses the original class as a property.
------------------------------------------------------------------------
[2004-05-18 12:02:25] bert at procurios dot nl
Description:
------------
Extending the built-in class 'mysqli' doesn't give the expected and
desired result. The extended class doesn't have the members the parent
class has and is unusable.
We found a related mailinglist entry from more than a year ago:
http://www.zend.com/lists/engine2/200302/msg00244.html
The possibility to extend built-in classes is a major feature in PHP5 -
at least for us ;).
The reproduce code below is a minimal testcase - other more complicated
tests failed as well.
Reproduce code:
---------------
class DB extends mysqli
{
}
$DB1 = new DB('localhost', 'root', '', 'probase2');
$DB2 = new mysqli('localhost', 'root', '', 'probase2');
var_dump($DB1->thread_id);
var_dump($DB1->error);
var_dump($DB1->errno);
var_dump($DB2->thread_id);
var_dump($DB2->error);
var_dump($DB2->errno);
Expected result:
----------------
int(97)
string(0) ""
int(0)
int(98)
string(0) ""
int(0)
Actual result:
--------------
<br />
<b>Notice</b>: Undefined property: DB::$thread_id in
<b>d:\htdocs_php5\ProBase2\TRUNK\probase\libsys\test.php</b> on line
<b>10</b><br />
NULL
<br />
<b>Notice</b>: Undefined property: DB::$error in
<b>d:\htdocs_php5\ProBase2\TRUNK\probase\libsys\test.php</b> on line
<b>11</b><br />
NULL
<br />
<b>Notice</b>: Undefined property: DB::$errno in
<b>d:\htdocs_php5\ProBase2\TRUNK\probase\libsys\test.php</b> on line
<b>12</b><br />
NULL
int(97)
string(0) ""
int(0)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28430&edit=1