Bug #71428 [NEW]: Validation type inheritance with = NULL

From: Date: Thu, 21 Jan 2016 18:52:49 +0000
Subject: Bug #71428 [NEW]: Validation type inheritance with = NULL
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198824@lists.php.net to get a copy of this message
From: dpa-bugs at aegee dot org Operating system: PHP version: 7.0.2 Package: Class/Object related Bug Type: Bug Bug description:Validation type inheritance with = 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 $a , $n) { echo "C.m";} }; $b = new B(); $b->m(new A(), $b); $c = new C(); $c->m(new A(), $b); ?> reports nothing, but shall report: PHP Warning: Declaration of C::m(A $a, $n) should be compatible with B::m(A $a = NULL, $n) on line 4 Removing on both places $n reports correctly: PHP Warning: Declaration of C::m(A $a) should be compatible with B::m(A $a = NULL) on line 4 Same with php 5.6.17. -- Edit bug report at https://bugs.php.net/bug.php?id=71428&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71428&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71428&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71428&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71428&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71428&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71428&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71428&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71428&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71428&r=support Expected behavior: https://bugs.php.net/fix.php?id=71428&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71428&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71428&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71428&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71428&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71428&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71428&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71428&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71428&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71428&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71428&r=mysqlcfg

« previous php.bugs (#198824) next »