1--TEST--
2Test array_map() function : object functionality - with non-existent class and method
3--FILE--
4<?php
5/* Prototype  : array array_map  ( callback $callback  , array $arr1  [, array $...  ] )
6 * Description: Applies the callback to the elements of the given arrays
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Testing array_map() for following object functionalities:
12 *   1) non-existent class
13 *   2) existent class and non-existent function
14 */
15echo "*** Testing array_map() :  with non-existent class and method ***\n";
16
17class SimpleClass
18{
19  public $var1 = 1;
20  public function square($n) {
21    return $n * $n;
22  }
23  public static function cube($n) {
24    return $n * $n * $n;
25  }
26}
27
28echo "-- with non-existent class --\n";
29var_dump( array_map(array('non-existent', 'square'), array(1, 2)) );
30
31echo "-- with existent class and non-existent method --\n";
32var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) );
33
34echo "Done";
35?>
36--EXPECTF--
37*** Testing array_map() :  with non-existent class and method ***
38-- with non-existent class --
39
40Warning: array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found in %s on line %d
41NULL
42-- with existent class and non-existent method --
43
44Warning: array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' in %s on line %d
45NULL
46Done
47