#49241 [NEW]: error in code by array just after upgrade 5.3

From: Date: Wed, 12 Aug 2009 22:25:43 +0000
Subject: #49241 [NEW]: error in code by array just after upgrade 5.3
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140992@lists.php.net to get a copy of this message
From:             yakucorp at gmail dot com
Operating system: centos 5.3
PHP version:      5.3.0
PHP Bug Type:     PHP options/info functions
Bug description:  error in code by array just after upgrade 5.3

Description:
------------
I just upgrade my php v to 5.3 and it appears this error.
this is my old script, and returns error like this




Reproduce code:
---------------
function fn_array_multisort()
{
	$n = func_num_args();
	$ar = func_get_arg(0);
	if(!is_array($ar)){
		return false;
	}

	for($i = 1; $i < $n; $i++){
		$col[$i] = func_get_arg($i);
	}

	foreach($ar as $key => $val){
		foreach($col as $kkey => $vval){
			if(is_string($vval)){
				${"subar$kkey"}[$key] = isset($val[$vval]) ? $val[$vval] : '';
			}
		}
	}

	$arv = array();
	foreach($col as $key => $val){
		$arv[] = (is_string($val) ? ${"subar$key"} : $val);
	}
	$arv[] = $ar;
	call_user_func_array("array_multisort", $arv);

	return $ar;
}

Expected result:
----------------
Warning: Parameter 1 to array_multisort() expected to be a reference,
value given in /usr/local/nginx/html/fox/core/fn_common.php on line 2000

Warning: Parameter 1 to array_multisort() expected to be a reference,
value given in /usr/local/nginx/html/fox/core/fn_common.php on line 2000

Warning: Parameter 1 to array_multisort() expected to be a reference,
value given in /usr/local/nginx/html/fox/core/fn_common.php on line 2000

Warning: Parameter 1 to array_multisort() expected to be a reference,
value given in /usr/local/nginx/html/fox/core/fn_common.php on line 2000

Warning: Parameter 1 to array_multisort() expected to be a reference,
value given in /usr/local/nginx/html/fox/core/fn_common.php on line 2000

Actual result:
--------------
call_user_func_array("array_multisort", $arv);

this line might be the clue call_user_func_array("array_multisort",
$arv);
please help, thanks

-- 
Edit bug report at http://bugs.php.net/?id=49241&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=49241&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=49241&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=49241&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=49241&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49241&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=49241&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=49241&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=49241&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=49241&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=49241&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=49241&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=49241&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=49241&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=49241&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49241&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49241&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=49241&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=49241&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=49241&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=49241&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=49241&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#140992) next »