php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31643 new array_merge behavior is inconsistent with other functions and PHP's spirit.
Submitted: 2005-01-21 19:11 UTC Modified: 2005-01-21 20:46 UTC
From: mkimsal at conduit-it dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.0.3 OS: Linux
Private report: No CVE-ID: None
 [2005-01-21 19:11 UTC] mkimsal at conduit-it dot com
Description:
------------
This creates a need to define variables before being used  
which is opposite of PHP's original behavior and spirit.   
This strange array_merge behavior is one step closer to  
making PHP a strongly typed language if the function  
behaves differently depending on whether or not aruments  
are defined and empty or not defined at all.  

Reproduce code:
---------------
$array2 = array('a');

$empty_var = array_merge($array1,$array2);



Expected result:
----------------
$empty_var should be an array with the same contents as 
array2. 

Actual result:
--------------
$empty_var contains no data at all.  This is different 
from PHP4 behavior with no benefits. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-21 20:46 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is a deliberate break and we\'re not going to change it back.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 16:01:29 2024 UTC