From:             bert at procurios dot nl
Operating system: All
PHP version:      5.0.0RC2
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Cannot extend built-in classes (mysqli)

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 bug report at http://bugs.php.net/?id=28430&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28430&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28430&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28430&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28430&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28430&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28430&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28430&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28430&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28430&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28430&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28430&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28430&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28430&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28430&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28430&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28430&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28430&r=float

Reply via email to