ID: 25494 Updated by: [EMAIL PROTECTED] Reported By: enygma at phpdeveloper dot org -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Any PHP Version: 4.3.2 New Comment:
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 undocumented feature is not our problem, but the users'. Previous Comments: ------------------------------------------------------------------------ [2003-09-19 08:25:32] [EMAIL PROTECTED] This behaviour IS documented for array_splice. This behaviour IS documented 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 PROTECTED] It can't break BC if the behaviour was undocumented and hence undefined. So either document the behaviour or fix the bug. Anybody relying on undocumented 'features' should know they're at risk for having those behaviours changed. J ------------------------------------------------------------------------ [2003-09-18 06:45:48] [EMAIL PROTECTED] 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 PROTECTED] Throwing an E_NOTICE error is not breaking anything. ------------------------------------------------------------------------ [2003-09-18 05:56:38] [EMAIL PROTECTED] This `fix' is inconsistent with array_splice, which allows you to add non-array arguments. (This is also documented.) Also, this `fix' breaks BC. Is this really needed? I'd rather have those functions convert non-array arguments into arrays and then perform their operations like array_splice() does. This has to be documented of course. ------------------------------------------------------------------------ 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 http://bugs.php.net/25494 -- Edit this bug report at http://bugs.php.net/?id=25494&edit=1