From: Contact at LinuxIntro dot com Operating system: Fedora PHP version: 5.2.6 PHP Bug Type: MySQLi related Bug description: no access to error when extended class
Description: ------------ I know that this is a 'no no', but i feel that the bug here was not bogus: http://bugs.php.net/bug.php?id=37711 I disagree with the response. $this is used in the current class, whereas parent:: is used to access properties and methods of the parent class. errno and error are properties of the parent class, NOT of $this class. Using $this to access the property of parent:: is not inheritance, it is more closely related to symbiosis or polymorphism, or something. And besides, how is parent:: automatically giving $this new properties called errno and error? Shouldn't that only be done via a set/get type function? EX: function GetErrno(){ $this->errno=parent::errno; } function GetError(){ $this->error=parent::error; } The fact that this is automatically available in the scope of $this is NOT inheritance, imho, it is a BUG. Alex Grim Reproduce code: --------------- class dbMYSQL extends mysqli { ... function __construct( parent::__construct($args....); echo parent::errno; echo parent::error; } ... } Expected result: ---------------- 0 '' or some error and error message when error occurs Actual result: -------------- Fatal error: Undefined class constant 'errno' Fatal error: Undefined class constant 'error' -- Edit bug report at http://bugs.php.net/?id=46494&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46494&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46494&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46494&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46494&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46494&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46494&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46494&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46494&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46494&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46494&r=support Expected behavior: http://bugs.php.net/fix.php?id=46494&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46494&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46494&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46494&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46494&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46494&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46494&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46494&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46494&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46494&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46494&r=mysqlcfg