smantoor                Tue Oct 28 10:21:13 2008 UTC

  Added files:                 
    /php-src/ext/standard/tests/array   
                                        array_intersect_uassoc_variation10.phpt 
                                        array_intersect_uassoc_variation1.phpt 
                                        array_intersect_uassoc_variation2.phpt 
                                        array_intersect_uassoc_variation3.phpt 
                                        array_intersect_uassoc_variation4.phpt 
                                        array_intersect_uassoc_variation5.phpt 
                                        array_intersect_uassoc_error.phpt 
                                        array_intersect_uassoc_variation6.phpt 
                                        array_intersect_uassoc_variation7.phpt 
                                        array_intersect_uassoc_variation8.phpt 
                                        array_intersect_uassoc_variation9.phpt 
  Log:
  New testcases for array_intersect_uassoc function
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - Passing class/object 
methods to callback
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

//Initialize variables
$array1 = array("a" => "green", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");
// define some class with method
class MyClass
{
        static function static_compare_func($a, $b) {
                return strcasecmp($a, $b);
        }
    
        public function class_compare_func($a, $b) {
                return strcasecmp($a, $b);
        }

}

echo "\n-- Testing array_intersect_uassoc() function using class with static 
method as callback --\n";
var_dump( array_intersect_uassoc($array1, $array2, 
array('MyClass','static_compare_func')) );
var_dump( array_intersect_uassoc($array1, $array2, 
'MyClass::static_compare_func'));

echo "\n-- Testing array_intersect_uassoc() function using class with regular 
method as callback --\n";
$obj = new MyClass();
var_dump( array_intersect_uassoc($array1, $array2, 
array($obj,'class_compare_func')) );
?>
===DONE===
--EXPECTF--
*** Testing array_intersect_uassoc() : usage variation ***

-- Testing array_intersect_uassoc() function using class with static method as 
callback --
array(1) {
  [u"a"]=>
  unicode(5) "green"
}
array(1) {
  [u"a"]=>
  unicode(5) "green"
}

-- Testing array_intersect_uassoc() function using class with regular method as 
callback --
array(1) {
  [u"a"]=>
  unicode(5) "green"
}
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - Passing unexpected 
values to first argument
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

// Initialise function arguments 
$array2 = array("a" => "green", "yellow", "red");
$array3 = array("a"=>"green", "brown");

//Callback function
function key_compare_func($a, $b) {
    if ($a === $b) {
        return 0;
    }
    return ($a > $b) ? 1 : -1;
}

//get an unset variable
$unset_var = 10;
unset ($unset_var);

//resource variable
$fp = fopen(__FILE__, "r");

// define some classes
class classWithToString
{
        public function __toString() {
                return "Class A object";
        }
}

class classWithoutToString
{
}

// heredoc string
$heredoc = <<<EOT
hello world
EOT;

// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);

//array of values to iterate over
$inputs = array(

      // int data
      'int 0' => 0,
      'int 1' => 1,
      'int 12345' => 12345,
      'int -12345' => -12345,

      // float data
      'float 10.5' => 10.5,
      'float -10.5' => -10.5,
      'float 12.3456789000e10' => 12.3456789000e10,
      'float -12.3456789000e10' => -12.3456789000e10,
      'float .5' => .5,

      // null data
      'uppercase NULL' => NULL,
      'lowercase null' => null,

      // boolean data
      'lowercase true' => true,
      'lowercase false' =>false,
      'uppercase TRUE' =>TRUE,
      'uppercase FALSE' =>FALSE,

      // empty data
      'empty string DQ' => "",
      'empty string SQ' => '',

      // string data
      'string DQ' => "string",
      'string SQ' => 'string',
      'mixed case string' => "sTrInG",
      'heredoc' => $heredoc,

      // object data
      'instance of classWithToString' => new classWithToString(),
      'instance of classWithoutToString' => new classWithoutToString(),

      // undefined data
      'undefined var' => @$undefined_var,

      // unset data
      'unset var' => @$unset_var,

      // resource data
      'resource' => $fp,
);

// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
      echo "\n--$key--\n";
      var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') );
      var_dump( array_intersect_uassoc($value, $array2, $array3, 
'key_compare_func') );
};

fclose($fp);
?>
===DONE===
--EXPECTF--

*** Testing array_intersect_uassoc() : usage variation ***

--int 0--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--int 1--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--int 12345--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--int -12345--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--float 10.5--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--float -10.5--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--float 12.3456789000e10--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--float -12.3456789000e10--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--float .5--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--uppercase NULL--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--lowercase null--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--lowercase true--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--lowercase false--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--uppercase TRUE--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--uppercase FALSE--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--empty string DQ--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--empty string SQ--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--string DQ--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--string SQ--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--mixed case string--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--heredoc--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--instance of classWithToString--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--instance of classWithoutToString--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--undefined var--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--unset var--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

--resource--

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #1 is not an array in %s on line %d
NULL
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - Passing unexpected 
values to second argument
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

// Initialise function arguments 
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array3 = array("a"=>"green", "brown");

//Callback function
function key_compare_func($a, $b) {
    if ($a === $b) {
        return 0;
    }
    return ($a > $b) ? 1 : -1;
}

//get an unset variable
$unset_var = 10;
unset ($unset_var);

//resource variable
$fp = fopen(__FILE__, "r");

// define some classes
class classWithToString
{
        public function __toString() {
                return "Class A object";
        }
}

class classWithoutToString
{
}

// heredoc string
$heredoc = <<<EOT
hello world
EOT;

// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);

//array of values to iterate over
$inputs = array(

      // int data
      'int 0' => 0,
      'int 1' => 1,
      'int 12345' => 12345,
      'int -12345' => -12345,

      // float data
      'float 10.5' => 10.5,
      'float -10.5' => -10.5,
      'float 12.3456789000e10' => 12.3456789000e10,
      'float -12.3456789000e10' => -12.3456789000e10,
      'float .5' => .5,

      // null data
      'uppercase NULL' => NULL,
      'lowercase null' => null,

      // boolean data
      'lowercase true' => true,
      'lowercase false' =>false,
      'uppercase TRUE' =>TRUE,
      'uppercase FALSE' =>FALSE,

      // empty data
      'empty string DQ' => "",
      'empty string SQ' => '',

      // string data
      'string DQ' => "string",
      'string SQ' => 'string',
      'mixed case string' => "sTrInG",
      'heredoc' => $heredoc,

      // object data
      'instance of classWithToString' => new classWithToString(),
      'instance of classWithoutToString' => new classWithoutToString(),

      // undefined data
      'undefined var' => @$undefined_var,

      // unset data
      'unset var' => @$unset_var,

      // resource data
      'resource' => $fp,
);

// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
      echo "\n--$key--\n";
      var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') );
      var_dump( array_intersect_uassoc($array1, $value, $array3, 
'key_compare_func') );
};

fclose($fp);
?>
===DONE===
--EXPECTF--

*** Testing array_intersect_uassoc() : usage variation ***

--int 0--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--int 1--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--int 12345--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--int -12345--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--float 10.5--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--float -10.5--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--float 12.3456789000e10--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--float -12.3456789000e10--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--float .5--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--uppercase NULL--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--lowercase null--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--lowercase true--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--lowercase false--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--uppercase TRUE--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--uppercase FALSE--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--empty string DQ--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--empty string SQ--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--string DQ--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--string SQ--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--mixed case string--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--heredoc--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--instance of classWithToString--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--instance of classWithoutToString--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--undefined var--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--unset var--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

--resource--

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL

Warning: array_intersect_uassoc(): Argument #2 is not an array in %s on line %d
NULL
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - Passing unexpected 
values to optional third argument
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

// Initialise function arguments 
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");

//Callback function
function key_compare_func($a, $b) {
    if ($a === $b) {
        return 0;
    }
    return ($a > $b) ? 1 : -1;
}

//get an unset variable
$unset_var = 10;
unset ($unset_var);

//resource variable
$fp = fopen(__FILE__, "r");

// define some classes
class classWithToString
{
        public function __toString() {
                return "Class A object";
        }
}

class classWithoutToString
{
}

// heredoc string
$heredoc = <<<EOT
hello world
EOT;

// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);

//array of values to iterate over
$inputs = array(

      // int data
      'int 0' => 0,
      'int 1' => 1,
      'int 12345' => 12345,
      'int -12345' => -12345,

      // float data
      'float 10.5' => 10.5,
      'float -10.5' => -10.5,
      'float 12.3456789000e10' => 12.3456789000e10,
      'float -12.3456789000e10' => -12.3456789000e10,
      'float .5' => .5,

      // null data
      'uppercase NULL' => NULL,
      'lowercase null' => null,

      // boolean data
      'lowercase true' => true,
      'lowercase false' =>false,
      'uppercase TRUE' =>TRUE,
      'uppercase FALSE' =>FALSE,

      // empty data
      'empty string DQ' => "",
      'empty string SQ' => '',

      // string data
      'string DQ' => "string",
      'string SQ' => 'string',
      'mixed case string' => "sTrInG",
      'heredoc' => $heredoc,

      // object data
      'instance of classWithToString' => new classWithToString(),
      'instance of classWithoutToString' => new classWithoutToString(),

      // undefined data
      'undefined var' => @$undefined_var,

      // unset data
      'unset var' => @$unset_var,

      // resource data
      'resource' => $fp,
);

// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
      echo "\n--$key--\n";
      var_dump( array_intersect_uassoc($array1, $array2, $value, 
'key_compare_func') );
};

fclose($fp);
?>
===DONE===
--EXPECTF--

*** Testing array_intersect_uassoc() : usage variation ***

--int 0--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--int 1--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--int 12345--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--int -12345--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--float 10.5--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--float -10.5--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--float 12.3456789000e10--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--float -12.3456789000e10--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--float .5--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--uppercase NULL--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--lowercase null--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--lowercase true--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--lowercase false--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--uppercase TRUE--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--uppercase FALSE--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--empty string DQ--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--empty string SQ--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--string DQ--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--string SQ--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--mixed case string--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--heredoc--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--instance of classWithToString--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--instance of classWithoutToString--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--undefined var--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--unset var--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL

--resource--

Warning: array_intersect_uassoc(): Argument #3 is not an array in %s on line %d
NULL
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation4.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation4.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation4.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - Passing unexpected 
values to mandatory third argument
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

// Initialise function arguments 
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");
$array3 = array("a"=>"green", "brown");

//get an unset variable
$unset_var = 10;
unset ($unset_var);

//resource variable
$fp = fopen(__FILE__, "r");

// define some classes
class classWithToString
{
        public function __toString() {
                return "Class A object";
        }
}

class classWithoutToString
{
}

// heredoc string
$heredoc = <<<EOT
hello world
EOT;

// add arrays
$index_array = array (1, 2, 3);
$assoc_array = array ('one' => 1, 'two' => 2);

//array of values to iterate over
$inputs = array(

      // int data
      'int 0' => 0,
      'int 1' => 1,
      'int 12345' => 12345,
      'int -12345' => -12345,

      // float data
      'float 10.5' => 10.5,
      'float -10.5' => -10.5,
      'float 12.3456789000e10' => 12.3456789000e10,
      'float -12.3456789000e10' => -12.3456789000e10,
      'float .5' => .5,

      // null data
      'uppercase NULL' => NULL,
      'lowercase null' => null,

      // boolean data
      'lowercase true' => true,
      'lowercase false' =>false,
      'uppercase TRUE' =>TRUE,
      'uppercase FALSE' =>FALSE,

      // object data
      'instance of classWithToString' => new classWithToString(),
      'instance of classWithoutToString' => new classWithoutToString(),

      // undefined data
      'undefined var' => @$undefined_var,

      // unset data
      'unset var' => @$unset_var,

      // resource data
      'resource' => $fp,
);

// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
      echo "\n--$key--\n";
      var_dump( array_intersect_uassoc($array1, $array2, $value) );
      var_dump( array_intersect_uassoc($array1, $array2, $array3, $value) );
};

fclose($fp);
?>
===DONE===
--EXPECTF--
*** Testing array_intersect_uassoc() : usage variation ***

--int 0--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--int 1--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--int 12345--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--int -12345--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--float 10.5--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--float -10.5--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--float 12.3456789000e10--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--float -12.3456789000e10--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--float .5--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--uppercase NULL--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--lowercase null--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--lowercase true--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--lowercase false--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--uppercase TRUE--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--uppercase FALSE--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--instance of classWithToString--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--instance of classWithoutToString--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--undefined var--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--unset var--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

--resource--

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
no array or string given in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - Intersection of 
integers with floats and strings.
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

//Initialize variables
$arr_default_int = array(1, 2 );
$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00);
$arr_string = array('1', '2', '3');
$arr_string_float = array('1.00', '2.00');

function key_compare_func($a, $b)
{
    if ($a === $b) {
        return 0;
    }
    return ($a > $b)? 1:-1;
}

echo "\n-- Result of integers and floating point intersection --\n";
var_dump( array_intersect_uassoc($arr_default_int, $arr_float, 
"key_compare_func") );

echo "\n-- Result of integers and strings containing integers intersection 
--\n";
var_dump( array_intersect_uassoc($arr_default_int, $arr_string, 
"key_compare_func") );

echo "\n-- Result of integers and strings containing floating points 
intersection --\n";
var_dump( array_intersect_uassoc($arr_default_int, $arr_string_float, 
"key_compare_func") );
?>
===DONE===
--EXPECTF--
*** Testing array_intersect_uassoc() : usage variation ***

-- Result of integers and floating point intersection --
array(2) {
  [0]=>
  int(1)
  [1]=>
  int(2)
}

-- Result of integers and strings containing integers intersection --
array(2) {
  [0]=>
  int(1)
  [1]=>
  int(2)
}

-- Result of integers and strings containing floating points intersection --
array(0) {
}
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_error.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_error.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_error.phpt
--TEST--
Test array_intersect_uassoc() function : error conditions 
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : error conditions ***\n";

// Initialise function arguments 
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");
$array3 = array("a"=>"green", "brown");
$extra_arg = 10;

//Callback function
function key_compare_func($a, $b) {
    if ($a === $b) {
        return 0;
    }
    return ($a > $b) ? 1 : -1;
}

//Test array_intersect_uassoc with one more than the expected number of 
arguments
echo "\n-- Testing array_intersect_uassoc() function with more than expected 
no. of arguments --\n";
var_dump( array_intersect_uassoc($array1, $array2, 
'key_compare_func',$extra_arg) );

// Testing array_intersect_uassoc with one less than the expected number of 
arguments
echo "\n-- Testing array_intersect_uassoc() function with less than expected 
no. of arguments --\n";
var_dump( array_intersect_uassoc($array1, $array2) );
var_dump( array_intersect_uassoc($array1, $array2, $array3) );

// Testing array_intersect_uassoc with no arguments
echo "\n-- Testing array_intersect_uassoc() function with no arguments --\n";
var_dump( array_intersect_uassoc() );
?>
===DONE===
--EXPECTF--
*** Testing array_intersect_uassoc() : error conditions ***

-- Testing array_intersect_uassoc() function with more than expected no. of 
arguments --

Warning: array_intersect_uassoc() expects parameter 4 to be a valid callback, 
no array or string given in %s on line %d
NULL

-- Testing array_intersect_uassoc() function with less than expected no. of 
arguments --

Warning: array_intersect_uassoc(): at least 3 parameters are required, 2 given 
in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
second array member is not a valid method in %s on line %d
NULL

-- Testing array_intersect_uassoc() function with no arguments --

Warning: array_intersect_uassoc(): at least 3 parameters are required, 0 given 
in %s on line %d
NULL
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - Intersection of 
floating points with strings.
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

//Initialize variables
$arr_float = array(0 => 1.00, 1.00 => 2.00);
$arr_string = array('1', '2', '3');
$arr_string_float = array('1.00', '2.00');

function key_compare_func($a, $b)
{
    if ($a === $b) {
        return 0;
    }
    return ($a > $b)? 1:-1;
}

echo "\n-- Result of floating points and strings containing integers 
intersection --\n";
var_dump( array_intersect_uassoc($arr_float, $arr_string, "key_compare_func") );

echo "\n-- Result of floating points and strings containing floating point 
intersection --\n";
var_dump( array_intersect_uassoc($arr_float, $arr_string_float, 
"key_compare_func") );
?>
===DONE===
--EXPECTF--
*** Testing array_intersect_uassoc() : usage variation ***

-- Result of floating points and strings containing integers intersection --
array(2) {
  [0]=>
  float(1)
  [1]=>
  float(2)
}

-- Result of floating points and strings containing floating point intersection 
--
array(0) {
}
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - Intersection of 
strings containing integers, float
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

//Initialize variables
$arr1_string_int = array('1', '2');
$arr2_string_int = array('1', '3');
$arr1_string_float = array('1.00', '2.00');
$arr2_string_float = array('1.00', '3.00');

function key_compare_func($a, $b)
{
    if ($a === $b) {
        return 0;
    }
    return ($a > $b)? 1:-1;
}

echo "\n-- Result of strings containing integers intersection --\n";
var_dump( array_intersect_uassoc($arr1_string_int, $arr2_string_int, 
"key_compare_func") );

echo "\n-- Result of strings containing floating points intersection --\n";
var_dump( array_intersect_uassoc($arr1_string_float, $arr2_string_float, 
"key_compare_func") );

echo "\n-- Result of strings containing integers and strings containing 
floating points intersection --\n";
var_dump( array_intersect_uassoc($arr1_string_int, $arr2_string_float, 
"key_compare_func") );
?>
===DONE===
--EXPECTF--
*** Testing array_intersect_uassoc() : usage variation ***

-- Result of strings containing integers intersection --
array(1) {
  [0]=>
  unicode(1) "1"
}

-- Result of strings containing floating points intersection --
array(1) {
  [0]=>
  unicode(4) "1.00"
}

-- Result of strings containing integers and strings containing floating points 
intersection --
array(0) {
}
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - arrays containing 
referenced variables
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

//Initialize variables
$ref_var = 'a';
$array1 = array('a', $ref_var);
$array2 = array('a' => 1, &$ref_var);

echo "\n-- Testing array_intersect_uassoc() function with referenced variable 
\$ref_var has value '$ref_var' --\n";
var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") );

// re-assign reference variable to different value
$ref_var = 10;
echo "\n-- Testing array_intersect_uassoc() function with referenced variable 
\$ref_var value changed to $ref_var --\n";
var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") );

//When array are referenced
$array2 = &$array1;
echo "\n-- Testing array_intersect_uassoc() function when \$array2 is referencd 
to \$array1 --\n";
var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") );
?>
===DONE===
--EXPECTF--
*** Testing array_intersect_uassoc() : usage variation ***

-- Testing array_intersect_uassoc() function with referenced variable $ref_var 
has value 'a' --
array(1) {
  [0]=>
  unicode(1) "a"
}

-- Testing array_intersect_uassoc() function with referenced variable $ref_var 
value changed to 10 --
array(0) {
}

-- Testing array_intersect_uassoc() function when $array2 is referencd to 
$array1 --
array(2) {
  [0]=>
  unicode(1) "a"
  [1]=>
  unicode(1) "a"
}
===DONE===

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt
+++ php-src/ext/standard/tests/array/array_intersect_uassoc_variation9.phpt
--TEST--
Test array_intersect_uassoc() function : usage variation - Passing non-existing 
function name to callback
--FILE--
<?php
/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array 
...], callback key_compare_func)
 * Description: Computes the intersection of arrays with additional index 
check, compares indexes by a callback function
 * Source code: ext/standard/array.c
 */

echo "*** Testing array_intersect_uassoc() : usage variation ***\n";

//Initialize variables
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");

//function name within double quotes
var_dump( array_intersect_uassoc($array1, $array2, "unknown_function") );

//function name within single quotes
var_dump( array_intersect_uassoc($array1, $array2, 'unknown_function') );

//function name without quotes
var_dump( array_intersect_uassoc($array1, $array2, unknown_function) );
?>
===DONE===
--EXPECTF--
*** Testing array_intersect_uassoc() : usage variation ***

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
function 'unknown_function' not found or invalid function name in %s on line %d
NULL

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
function 'unknown_function' not found or invalid function name in %s on line %d
NULL

Notice: Use of undefined constant unknown_function - assumed 'unknown_function' 
in %s on line %d

Warning: array_intersect_uassoc() expects parameter 3 to be a valid callback, 
function 'unknown_function' not found or invalid function name in %s on line %d
NULL
===DONE===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to