#33902 [Opn->Csd]: Type hinting incorrect behavior
| From: | sniper@php.net | Date: | Thu, 28 Jul 2005 14:26:53 +0000 |
| Subject: | #33902 [Opn->Csd]: Type hinting incorrect behavior | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-82598@lists.php.net to get a copy of this message | ||
ID: 33902
Updated by: sniper@php.net
Reported By: sveta at microbecal dot com
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: FreeBSD, WindowsXP
PHP Version: 5.0.4
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-07-28 13:33:04] sveta at microbecal dot com
Description:
------------
In my example type hinting in method foo() in child class is
incompatible with same method in parent class. But it still working
with E_STRICT.
Reproduce code:
---------------
error_reporting(E_ALL | E_STRICT);
class A {}
abstract class B {
protected $bar;
public function foo($bar) {
$this->bar = $bar;
echo "some\n";
return $this;
}
}
class C extends B
{
public function foo(A $bar)
{
$this->bar = $bar;
echo "not expected\n";
return $this;
}
}
$c = new C;
$c->foo(new A);
Expected result:
----------------
Fatal error: Declaration of C::foo() must be compatible with that of
B::foo()
Actual result:
--------------
not expected
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33902&edit=1