PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » PHP » PHP_Compat » Bug #6687

array_intersect_key() fails due to func_get_args()

Details

Submitted2006-02-03 16:48 UTC
Fromdaniel at easetechnology dot co dot uk
Assignedarpad
StatusClosed
PackagePHP_Compat
PHP Version4.3.10
OSLinux 2.4.20
Roadmaps1.6.0a1

Comments

[2006-02-03 16:48 UTC] daniel at easetechnology dot co dot uk

Description:
------------
Calling array_intersect_key fails with an error message:

Fatal error: func_get_args(): Can't be used as a function parameter

Other functions implemented in the same way may have the same bug; I haven't checked.

Test script:
---------------
<?php
require_once 'lib/PHP/Compat/Function/array_intersect_key.php';

$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);

print_r(php_compat_array_intersect_key($array1, $array2));

print_r(array_intersect_key(
array('a'=>1, 'b'=>2, 'c'=>3, 'd'=>4),
array('a'=>0, 'c'=>0),
array('a'=>0, 'd'=>4)
));
?>

Expected result:
----------------
no error messages

Actual result:
--------------
Array ( [blue] => 1 [green] => 3 ) Fatal error: func_get_args(): Can't be used as a function parameter in /home/davidhall/public_html/mercury/lib/PHP/Compat/Function/array_intersect_key.php on line 67