php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31216 array_merge_recursive change in behaviour php4>5
Submitted: 2004-12-21 04:25 UTC Modified: 2004-12-21 08:42 UTC
From: fire at firepages dot com dot au Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.3 OS: win32 XP SP1
Private report: No CVE-ID: None
 [2004-12-21 04:25 UTC] fire at firepages dot com dot au
Description:
------------
in php4 array_merge_recursive($arr1,$arr...) allowed the first array argument to be unassigned , in php5 it requires inintialising.

perhaps php4 behaviour was a feature-bug ?



Reproduce code:
---------------
while( $whatever ){
  $arr = foo->get_arr();
  $tmp = array_merge_recursive( $tmp , $arr ) ;
}

Expected result:
----------------
$tmp is created if !exists & continues as expected

Actual result:
--------------
PHP-4.3.8 >> $tmp is created if !exists & continues as expected

PHP-5.0.3 Warning: array_merge_recursive() Argument #1 is not an array in ....

easily  `solved` by initialising $tmp prior to use $tmp=array(); just unsure if this is intended ?

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-21 08:42 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

Read the migration part in the PHP Manual.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Aug 15 16:01:28 2024 UTC