php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #52716 Interface difference between 5.2.6 and 5.3.2
Submitted: 2010-08-27 09:45 UTC Modified: 2010-10-22 09:20 UTC
From: analytik at uglycode dot com Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Kubuntu and Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: analytik at uglycode dot com
New email:
PHP Version: OS:

 

 [2010-08-27 09:45 UTC] analytik at uglycode dot com
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-20 08:36 UTC] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=304533
Log: Fixed bug #52716 (Interface difference between 5.2.6 and 5.3.2)
 [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
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2010-10-20 21:24 UTC] jpauli@php.net
Kalle, could you clarify your patch ?
It seems to say the opposite, or at least I misunderstood it.

Even for my language (french), I admit it's hard to translate for the end-user to fully understand the new behavior.
 [2010-10-22 04:16 UTC] kalle@php.net
jpauli:
I did some testing across all versions of the 5.1, 5.2 and 5.3 branches and it was changed in 5.3+. My testing indicated that all 5.1 and 5.2 versions worked the same here.

As for the wording, I could not find a better way to make it more clear, feel free to improve it if you can come up with a better meaning.
 [2010-10-22 09:20 UTC] jpauli@php.net
Ok, I did some tests as well and I confirm this bug report.
I translated in my language, I found the words ;-)
 [2020-02-07 06:09 UTC] phpdocbot@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=a203d8319f4cc0a9c97f7fc1717dd54c21495c48
Log: Fixed bug #52716 (Interface difference between 5.2.6 and 5.3.2)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 14:00:01 2026 UTC