On Sat, Apr 3, 2010 at 4:33 PM, Ralph Schindler <ra...@smashlabs.com> wrote:
> Stanislav Malyshev wrote:
>>
>> Hi!
>>
>>> class Filter {
>>> public function __construct() { /* construct stuff */ }
>>> public function filter($value) { /* return filtered */ }
>>> }
>>>
>>> Produces:
>>>
>>> PHP Strict Standards: Redefining already defined constructor for
>>> class Zend\Filter\Filter in [snip file] on line [snip line]
>>
>> I just checked - this code produces the same warning in 5.2 (without the
>> namespace of course), and in 5.3.0. So I don't see what changed in 5.3.1
>> exactly?
>
> Nothing changed, you are right, the behavior is there in all these versions.
>
> My PHP's for 5.3.0 and 5.3.1&2 have different default values for
> error_reporting, and since changing to E_STRICT at runtime is too late (file
> already compiled with error_reporting of php.ini), I was not triggering the
> code properly.
>
> (My 5.3.0 was shipped from apple, as was their php.ini which the default
> error_reporting value is E_ALL & ~E_NOTICE & ~E_DEPRECATED, not the newly
> recommended php.ini-development value of E_ALL | E_STRICT.  Also, in 5.2
> series, the PHP group never recommended to use E_STRICT in the php.ini,
> another reason the code was not triggered in my testing.)
>
> -ralph
>

sorry for resurrecting this thread:
I've had a discussion about this change recently, and I re-read the
whole thread to refresh my memories.
did I miss something, or did we really introduce this BC break based
on a "bogus" report?
I mean, based on Ralph's last email, it seems that the reported
warning was present in all previous versions, and the problem has
nothing to do with namespaces.

btw. I tried to reproduce the problem now, but the E_STRICT only
triggered, if I swapped the order of the __construct and filter
definition, which seems logical, cause if we have the __construct
first, then the classname ctor cannot override that(only the other way
around supported).
I looked around, and I found out that this change was introduced by
Felipe: https://bugs.php.net/bug.php?id=52160
he basically implemented Ralphs original patch/suggestion on his own.

does anybody else thinks that this is a good example what/how not to do things?

ps: Andi mentioned in this thread that we should mark the classname
ctors deprecated with the next version, if we want that, now is the
time.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to