Annotation of embedaddon/php/ext/standard/tests/array/bug28739.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #28739 (*diff() and *intersect() not clearing the fci cache before work)
                      3: --FILE--
                      4: <?php
                      5: class p {
                      6:    public $x;
                      7:    function __construct($x){$this->x=$x;}
                      8: }
                      9: function a(&$a, &$b){var_dump(__FUNCTION__);return $a->x - $b->x;}
                     10: function b(&$a, &$b){var_dump(__FUNCTION__);return $a->x - $b->x;}
                     11: 
                     12: $p1 = array(new p(2), new p(1), new p(0));
                     13: $p2 = array(new p(0), new p(2), new p(3));
                     14: 
                     15: uasort($p1, 'a');
                     16: print_r($p1);
                     17: echo "Now diffing:\n";
                     18: print_r(array_udiff($p1,$p2, 'b'));
                     19: ?>
                     20: --EXPECT--
                     21: string(1) "a"
                     22: string(1) "a"
                     23: Array
                     24: (
                     25:     [2] => p Object
                     26:         (
                     27:             [x] => 0
                     28:         )
                     29: 
                     30:     [1] => p Object
                     31:         (
                     32:             [x] => 1
                     33:         )
                     34: 
                     35:     [0] => p Object
                     36:         (
                     37:             [x] => 2
                     38:         )
                     39: 
                     40: )
                     41: Now diffing:
                     42: string(1) "b"
                     43: string(1) "b"
                     44: string(1) "b"
                     45: string(1) "b"
                     46: string(1) "b"
                     47: string(1) "b"
                     48: string(1) "b"
                     49: string(1) "b"
                     50: string(1) "b"
                     51: Array
                     52: (
                     53:     [1] => p Object
                     54:         (
                     55:             [x] => 1
                     56:         )
                     57: 
                     58: )

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