Bug->Doc #66926 [Asn->Ver]: Missing Information in translation
| From: | cmb@php.net | Date: | Fri, 17 Apr 2015 11:21:56 +0000 |
| Subject: | Bug->Doc #66926 [Asn->Ver]: Missing Information in translation | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12186@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66926&edit=1
ID: 66926
Updated by: cmb@php.net
Reported by: wako057 at gmail dot com
Summary: Missing Information in translation
-Status: Assigned
+Status: Verified
-Type: Bug
+Type: Documentation Problem
-Package: Documentation problem
+Package: Scripting Engine problem
Operating System: Debian
PHP Version: Irrelevant
-Assigned To: cmb
+Assigned To:
Block user comment: N
Private report: N
New Comment:
> The problem describe here is php raised an error depending on
> which method the parser find first, not if it is present or not.
Thanks, now its clear to me what you are referring to. And indeed,
the documentation should be improved.
Previous Comments:
------------------------------------------------------------------------
[2015-04-17 08:41:35] wako057 at gmail dot com
Hello,
The qualification is maybe not the correct one, it can be a parser probleme.
My native language is French.
Assuming english is not my native one maybe im wrong, but I think both doc are inexact:
Doc:
For backwards compatibility, if PHP 5 cannot find a __construct() function for a given class, and
the class did not inherit one from a parent class, it will search for the old-style constructor
function, by the name of the class. Effectively, it means that the only case that would have
compatibility issues is if the class had a method named __construct() which was used for different
semantics.
So <<if PHP 5 cannot find>>
The problem describe here is php raised an error depending on which method the parser find first,
not if it is present or not.
Regards.
------------------------------------------------------------------------
[2015-04-17 00:35:43] cmb@php.net
The reported behavior is to be expected, see the man page on
"Constructors and Destructors"[1].
You have filed this as "Missing Information in translation", so we
have to assume that there is a documentation translation problem.
It is not clear, however, which translation (i.e. language) is
affected. Can you please clarify?
[1] <http://php.net/manual/en/language.oop5.decon.php>
------------------------------------------------------------------------
[2014-03-18 16:39:53] wako057 at gmail dot com
Description:
------------
I've tested this issue on php 5.3.28 and php 5.5.10
When the parser found in class a method called as the class, insensitive to the case, it generate a
Strict Standard error.
But if it found the __construct first, at this moment no error is raised.
With namespace the case doesn't happened at all.
Test script:
---------------
<?php
class Foo {
public function foo() {
echo 'ahaha';
}
function __construct() {
echo 'hihi';
}
}
Generate a: PHP Strict Standards: Redefining already defined constructor for class Foo
BUT
<?php
class Foo {
function __construct() {
echo 'hihi';
}
public function foo() {
echo 'ahaha';
}
}
Don't
<?php
namespace Bar;
class Foo {
public function foo() {
echo 'ahaha';
}
function __construct() {
echo 'hihi';
}
}
new Foo();
Neither
Expected result:
----------------
When a __construct is present, no error should be raised
Actual result:
--------------
Strict Standards: Redefining already defined constructor for class Foo in /var/www/tt.php on line 7
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66926&edit=1