Re: com php-src: Fix bug #67064 in a BC safe way You can use an optional parameter now when implementing the Countable interface to get the $mode
passed to count().: ext/standard/array.c ext/standard/tests/array/bug67064.phpt

From: Date: Sun, 13 Apr 2014 20:41:24 +0000
Subject: Re: com php-src: Fix bug #67064 in a BC safe way You can use an optional parameter now when implementing the Countable interface to get the $mode
passed to count().: ext/standard/array.c ext/standard/tests/array/bug67064.phpt
References: 1 2 3 4  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-76835@lists.php.net to get a copy of this message
On Sun, Apr 13, 2014 at 10:32 PM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:

> Hi!
>
> > an API change. The interface hasn't changed.
>
> It has. Formerly, you did not have a parameter supplied for this
> function, starting with next version, you do. If you write code that
> implements this function, you need to know it changed.
>
> Also, this change seems to break a lot of tests, see:
> https://travis-ci.org/php/php-src/builds/22895161
>
> Looks like it is not as BC safe as it was intended. Please fix it or
> revert the change - BC break in 5.4 is not acceptable.
>
> > It'd only be an API change if it forced the user to change its
> declaration.
>
> Not true. For example, we document new functions in UPGRADING, even
> though adding new functions does not force anybody to change anything.
> Same with new parameter to existing functions - see for example "Changes
> to existing functions" section.
>
> > I'll add some documentation about that.
>
> Thank you.
>

I generally think that this change merits further discussion. While it
might not technically be a BC break (apart from the issue with internal
classes that you have already pointed out), it does break the meaning of
the interface or rather expectations about it. Right now, if you implement
Countable, you just implement count() in its normal behavior.
COUNT_RECURSIVE won't work. Now with this option there is the expectation
that a class implementing Countable will actually also implement the
count() mode argument. I don't think that's good, especially as the option
is practically useless (I have not used it even a single time).

Nikita


Thread (10 messages)

« previous php.cvs (#76835) next »