Inconsistent behavior when using interfaces
| From: | Ralph Schindler | Date: | Mon, 21 May 2007 19:32:27 +0000 |
| Subject: | Inconsistent behavior when using interfaces | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-29635@lists.php.net to get a copy of this message | ||
Is this a problem or not?
The following will produce this notice:
Strict Standards: Declaration of Z_Concrete::__get() should be compatible with that of Z_Abstract::__get() in xxx on line 16
<?php
error_reporting(E_ALL | E_STRICT);
interface Z_Interface
{ }
abstract class Z_Abstract implements Z_Interface
{
public function __get($name)
{
return;} } class Z_Concrete extends Z_Abstract { public function & __get($name) {
return null;} } $t = new Z_Concrete(); This code will not produce a notice: <?php error_reporting(E_ALL | E_STRICT); abstract class Z_Abstract { public function __get($name) {
return;} } class Z_Concrete extends Z_Abstract { public function & __get($name) {
return null;} } $t = new Z_Concrete(); The only difference is that the former has an interface as a parent, the latter does not. Is this a bug? -ralph CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is being sent by 3Com for the sole use of the intended recipient(s) and may contain confidential, proprietary and/or privileged information. Any unauthorized review, use, disclosure and/or distribution by any recipient is prohibited. If you are not the intended recipient, please delete and/or destroy all copies of this message regardless of form and any included attachments and notify 3Com immediately by contacting the sender via reply e-mail or forwarding to 3Com at postmaster@3com.com.