ID: 25494
Updated by: [email]etphp.net[/email]
Reported By: enygma at phpdeveloper dot org
Status: Bogus
Bug Type: Arrays related
Operating System: Any
PHP Version: 4.3.2
New Comment:

Merging a single element into an array does make sense.
> *array*_merge merges arrays, not booleans, or ints, or strings.
Then why str_repeat(10,10) repeats the int?


Previous Comments:
------------------------------------------------------------------------

[2003-09-19 10:36:13] [email]derickphp.net[/email]

This current behavior is correct. *array*_merge merges arrays, not
booleans, or ints, or strings. Silently converting those to arrays
makes no sense, and is quite confusing. Also, relying on an
undoented feature is not our problem, but the users'.

------------------------------------------------------------------------

[2003-09-19 08:25:32] [email]etphp.net[/email]

This behaviour IS doented for array_splice.
This behaviour IS doented in the type juggling chapter of the PHP
manual.
Additionally, it's the standard way for PHP to handle arguments of the
`wrong' type: It casts.
You don't consider it a bug that floor("3.2") returns float(3), do
you?
But you consider it a bug that array_merge() casts to array if it
doesn't get one?
Major inconsistency there.

------------------------------------------------------------------------

[2003-09-18 15:06:06] [email]jayphp.net[/email]

It can't break BC if the behaviour was undoented and
hence undefined. So either doent the behaviour or fix
the bug.

Anybody relying on undoented 'features' should know
they're at risk for having those behaviours changed.

J

------------------------------------------------------------------------

[2003-09-18 06:45:48] [email]etphp.net[/email]

It's still inconsistent, and `will throw a warning and fail in 5 for
non-array arguments' will break BC without a need for it.

------------------------------------------------------------------------

[2003-09-18 06:08:03] [email]sniperphp.net[/email]

Throwing an E_NOTICE error is not breaking anything.


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
[url]http://bugs.php.net/25494[/url]

--
Edit this bug report at [url]http://bugs.php.net/?id=25494&edit=1[/url]