Inconsistent behavior when using interfaces

php.internals

Ralph Schindler

19 years ago
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.

Marcus Börger

19 years ago
Hello Ralph, Monday, May 21, 2007, 9:32:27 PM, you wrote:
> 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?
yes best regards marcus Now completely out of topic:
> CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, > is being sent by 3Com
bla bullshit nonsense in the same manner i guess it makes no sense tocommunicate further? :-) this is a general consideration, people should stop sending these non applicable message stubs. They render open source unuseable. Best regards, Marcus

Ralph Schindler

19 years ago
Marcus Boerger wrote:
> > yes >
I will submit it to bugs.php.net
> > in the same manner i guess it makes no sense tocommunicate further? :-) > > this is a general consideration, people should stop sending these non > applicable message stubs. They render open source unuseable. >
Yeah, as much as I agree, the only SMTP server available to me at the time of sending the message was over my work vpn connection, so I am at their discretion. Coffeeshops, unfortunately, don't allow any outgoing port 25 traffic. So oh well. Thanks, -ralph