Annotation of embedaddon/php/ext/standard/tests/array/array_diff_uassoc_variation14.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test array_diff_uassoc() function : usage variation -Passing classWithoutToString (handling fatal error) to callback
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
        !             6:  * Description: Computes the difference of arrays with additional index check which is performed by a 
        !             7:  *                             user supplied callback function
        !             8:  * Source code: ext/standard/array.c
        !             9:  */
        !            10: 
        !            11: echo "*** Testing array_diff_uassoc() : usage variation ***\n";
        !            12: 
        !            13: //Initialize array
        !            14: $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
        !            15: $array2 = array("a" => "green", "yellow", "red");
        !            16: 
        !            17: class classWithoutToString
        !            18: {
        !            19: }
        !            20: 
        !            21: // Define error handler
        !            22: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
        !            23:        if (error_reporting() != 0) {
        !            24:                // report non-silenced errors
        !            25:                echo "Error: $err_no - $err_msg, $filename($linenum)\n";
        !            26:        }
        !            27: }
        !            28: set_error_handler('test_error_handler');
        !            29: 
        !            30: $value = new classWithoutToString();
        !            31: var_dump( array_diff_uassoc($array1, $array2, $value) );
        !            32: 
        !            33: ?>
        !            34: ===DONE===
        !            35: --EXPECTF--
        !            36: *** Testing array_diff_uassoc() : usage variation ***
        !            37: Error: 2 - array_diff_uassoc() expects parameter 3 to be a valid callback, no array or string given, %s(%d)
        !            38: NULL
        !            39: ===DONE===
        !            40: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>