|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-10-20 08:36 UTC] kalle@php.net
[2010-10-20 08:36 UTC] kalle@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: kalle
[2010-10-20 08:36 UTC] kalle@php.net
[2010-10-20 21:24 UTC] jpauli@php.net
[2010-10-22 04:16 UTC] kalle@php.net
[2010-10-22 09:20 UTC] jpauli@php.net
[2020-02-07 06:09 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 13:00:02 2026 UTC |
Description: ------------ PHP versions: 5.3.2-1ubuntu4.2 5.2.6-1+lenny9 There isn't mentioned a difference between 5.2 and 5.3 in interface behavior. In 5.2, if defined class/method has default values, interface MUST have default values. In 5.3, interface DOES NOT NEED TO have default values. Test script: --------------- <?php error_reporting(E_ALL | E_STRICT); interface DefaultsInterface { public function foobar($a = false, $b = false, $c = false); } interface ParamsInterface { public function fubar($a, $b, $c); } class WorksFine implements DefaultsInterface { public function foobar($a = true, $b = false, $c = true) {} } class DiesOnFiveTwo implements ParamsInterface { public function fubar($a = true, $b = false, $c = true) {} } $a = new WorksFine(); $b = new DiesOnFiveTwo(); var_dump($a, $b); Expected result: ---------------- I expect the documentation to mention the difference. Actual result: -------------- 5.3 result: object(WorksFine)[1] object(DiesOnFiveTwo)[2] 5.2 result: Fatal error: Declaration of DiesOnFiveTwo::fubar() must be compatible with that of ParamsInterface::fubar() in /var/www/dev.piklio.com/httpdocs/faces.php on line 17