Bug #71426 [NEW]: Inheritance, signature verifications, type hints, pass by reference and NULL
| From: | dpa-bugs at aegee dot org | Date: | Thu, 21 Jan 2016 17:53:40 +0000 |
| Subject: | Bug #71426 [NEW]: Inheritance, signature verifications, type hints, pass by reference and NULL | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-198822@lists.php.net to get a copy of this message | ||
From: dpa-bugs at aegee dot org
Operating system: any
PHP version: 5.6.17
Package: Class/Object related
Bug Type: Bug
Bug description:Inheritance, signature verifications, type hints, pass by reference and NULL
Description:
------------
<?php
class A { }
class B { public function m(A $a = NULL, &$n) { echo "B.m";}
};
class C extends B { public function m( $a ) { echo "C.m";}
};
$b = new B();
$b->m(new A(), $b);
$c = new C();
$c->m(new A(), $b);
?>
reports:
PHP Warning: Declaration of C::m($a) should be compatible with B::m(A
$a, &$n) on line 4
but shall report:
PHP Warning: Declaration of C::m($a) should be compatible with B::m(A
$a = NULL, &$n) on line 4
The same happens with php 5.6.17 .
Just removing &$n leads to the correct "PHP Warning: Declaration of
C::m($a) should be compatible with B::m(A $a = NULL) on line 4"
--
Edit bug report at https://bugs.php.net/bug.php?id=71426&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71426&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71426&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71426&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71426&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71426&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71426&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71426&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71426&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71426&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71426&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71426&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71426&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71426&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71426&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71426&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71426&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71426&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71426&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71426&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71426&r=mysqlcfg