#46494 [Opn->Bgs]: no access to error when extended class
| From: | johannes@php.net | Date: | Wed, 05 Nov 2008 21:25:11 +0000 |
| Subject: | #46494 [Opn->Bgs]: no access to error when extended class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-130670@lists.php.net to get a copy of this message | ||
ID: 46494
Updated by: johannes@php.net
Reported By: Contact at LinuxIntro dot com
-Status: Open
+Status: Bogus
Bug Type: MySQLi related
Operating System: Fedora
PHP Version: 5.2.6
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
parent:: is for accessing the base implementation of a overwritten
method, such a thing doesn't exist with properties.
Even if this would be a bug (what it isn't) it won't be a MySQLi issue.
Previous Comments:
------------------------------------------------------------------------
[2008-11-05 10:58:33] Contact at LinuxIntro dot com
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 this bug report at http://bugs.php.net/?id=46494&edit=1