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

1.1     ! misho       1: --TEST--
        !             2: Test array_merge_recursive() function : usage variations - unexpected values for $arr1 argument
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : array array_merge_recursive(array $arr1[, array $...])
        !             6:  * Description: Recursively merges elements from passed arrays into one array
        !             7:  * Source code: ext/standard/array.c
        !             8: */
        !             9: 
        !            10: /*
        !            11:  * Passing non array values to 'arr1' argument of array_merge_recursive() and see 
        !            12:  * that the function outputs proper warning messages wherever expected.
        !            13: */
        !            14: 
        !            15: echo "*** Testing array_merge_recursive() : Passing non array values to \$arr1 argument ***\n";
        !            16: 
        !            17: //get an unset variable
        !            18: $unset_var = 10;
        !            19: unset($unset_var);
        !            20: 
        !            21: class A
        !            22: {
        !            23: //  public $var = 10;
        !            24:   public function __toString() {
        !            25:     return "object";
        !            26:   }
        !            27: }
        !            28: 
        !            29: // heredoc string
        !            30: $heredoc = <<<EOT
        !            31: hello world
        !            32: EOT;
        !            33: 
        !            34: // get a resource variable
        !            35: $fp = fopen(__FILE__, "r");
        !            36: 
        !            37: // unexpected values to be passed to $arr1 argument
        !            38: $arrays = array (
        !            39: 
        !            40:        // int data
        !            41: /*1*/  0,
        !            42:        1,
        !            43:        12345,
        !            44:        -2345,
        !            45: 
        !            46:        // float data
        !            47: /*5*/  10.5,
        !            48:        -10.5,
        !            49:        12.3456789000e10,
        !            50:        12.3456789000E-10,
        !            51:        .5,
        !            52: 
        !            53:        // null data
        !            54: /*10*/ NULL,
        !            55:        null,
        !            56: 
        !            57:        // boolean data
        !            58: /*12*/ true,
        !            59:        false,
        !            60:        TRUE,
        !            61:        FALSE,
        !            62: 
        !            63:        // empty data
        !            64: /*16*/ "",
        !            65:        '',
        !            66: 
        !            67:        // string data
        !            68: /*18*/ "string",
        !            69:        'string',
        !            70:        $heredoc,
        !            71: 
        !            72:        // undefined data
        !            73: /*21*/ @$undefined_var,
        !            74: 
        !            75:        // unset data
        !            76: /*22*/ @$unset_var,
        !            77: 
        !            78:        // resource variable
        !            79: /*23*/ $fp,
        !            80: 
        !            81:        // object data
        !            82: /*24*/ new A()
        !            83: );
        !            84: 
        !            85: // initialise the second argument 
        !            86: $arr2 = array(1, array("hello", 'world'));
        !            87: 
        !            88: // loop through each element of $arrays and check the behavior of array_merge_recursive()
        !            89: $iterator = 1;
        !            90: foreach($arrays as $arr1) {
        !            91:   echo "\n-- Iteration $iterator --";
        !            92:   
        !            93:   // with default argument
        !            94:   echo "\n-- With default argument --";
        !            95:   var_dump( array_merge_recursive($arr1) );
        !            96:  
        !            97:   // with more arguments
        !            98:   echo "-- With more arguments --";
        !            99:   var_dump( array_merge_recursive($arr1, $arr2) );
        !           100:  
        !           101:   $iterator++;
        !           102: }
        !           103: 
        !           104: // close the file resource used
        !           105: fclose($fp);
        !           106: 
        !           107: echo "Done";
        !           108: ?>
        !           109: --EXPECTF--
        !           110: *** Testing array_merge_recursive() : Passing non array values to $arr1 argument ***
        !           111: 
        !           112: -- Iteration 1 --
        !           113: -- With default argument --
        !           114: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           115: NULL
        !           116: -- With more arguments --
        !           117: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           118: NULL
        !           119: 
        !           120: -- Iteration 2 --
        !           121: -- With default argument --
        !           122: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           123: NULL
        !           124: -- With more arguments --
        !           125: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           126: NULL
        !           127: 
        !           128: -- Iteration 3 --
        !           129: -- With default argument --
        !           130: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           131: NULL
        !           132: -- With more arguments --
        !           133: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           134: NULL
        !           135: 
        !           136: -- Iteration 4 --
        !           137: -- With default argument --
        !           138: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           139: NULL
        !           140: -- With more arguments --
        !           141: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           142: NULL
        !           143: 
        !           144: -- Iteration 5 --
        !           145: -- With default argument --
        !           146: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           147: NULL
        !           148: -- With more arguments --
        !           149: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           150: NULL
        !           151: 
        !           152: -- Iteration 6 --
        !           153: -- With default argument --
        !           154: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           155: NULL
        !           156: -- With more arguments --
        !           157: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           158: NULL
        !           159: 
        !           160: -- Iteration 7 --
        !           161: -- With default argument --
        !           162: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           163: NULL
        !           164: -- With more arguments --
        !           165: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           166: NULL
        !           167: 
        !           168: -- Iteration 8 --
        !           169: -- With default argument --
        !           170: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           171: NULL
        !           172: -- With more arguments --
        !           173: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           174: NULL
        !           175: 
        !           176: -- Iteration 9 --
        !           177: -- With default argument --
        !           178: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           179: NULL
        !           180: -- With more arguments --
        !           181: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           182: NULL
        !           183: 
        !           184: -- Iteration 10 --
        !           185: -- With default argument --
        !           186: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           187: NULL
        !           188: -- With more arguments --
        !           189: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           190: NULL
        !           191: 
        !           192: -- Iteration 11 --
        !           193: -- With default argument --
        !           194: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           195: NULL
        !           196: -- With more arguments --
        !           197: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           198: NULL
        !           199: 
        !           200: -- Iteration 12 --
        !           201: -- With default argument --
        !           202: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           203: NULL
        !           204: -- With more arguments --
        !           205: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           206: NULL
        !           207: 
        !           208: -- Iteration 13 --
        !           209: -- With default argument --
        !           210: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           211: NULL
        !           212: -- With more arguments --
        !           213: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           214: NULL
        !           215: 
        !           216: -- Iteration 14 --
        !           217: -- With default argument --
        !           218: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           219: NULL
        !           220: -- With more arguments --
        !           221: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           222: NULL
        !           223: 
        !           224: -- Iteration 15 --
        !           225: -- With default argument --
        !           226: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           227: NULL
        !           228: -- With more arguments --
        !           229: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           230: NULL
        !           231: 
        !           232: -- Iteration 16 --
        !           233: -- With default argument --
        !           234: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           235: NULL
        !           236: -- With more arguments --
        !           237: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           238: NULL
        !           239: 
        !           240: -- Iteration 17 --
        !           241: -- With default argument --
        !           242: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           243: NULL
        !           244: -- With more arguments --
        !           245: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           246: NULL
        !           247: 
        !           248: -- Iteration 18 --
        !           249: -- With default argument --
        !           250: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           251: NULL
        !           252: -- With more arguments --
        !           253: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           254: NULL
        !           255: 
        !           256: -- Iteration 19 --
        !           257: -- With default argument --
        !           258: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           259: NULL
        !           260: -- With more arguments --
        !           261: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           262: NULL
        !           263: 
        !           264: -- Iteration 20 --
        !           265: -- With default argument --
        !           266: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           267: NULL
        !           268: -- With more arguments --
        !           269: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           270: NULL
        !           271: 
        !           272: -- Iteration 21 --
        !           273: -- With default argument --
        !           274: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           275: NULL
        !           276: -- With more arguments --
        !           277: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           278: NULL
        !           279: 
        !           280: -- Iteration 22 --
        !           281: -- With default argument --
        !           282: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           283: NULL
        !           284: -- With more arguments --
        !           285: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           286: NULL
        !           287: 
        !           288: -- Iteration 23 --
        !           289: -- With default argument --
        !           290: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           291: NULL
        !           292: -- With more arguments --
        !           293: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           294: NULL
        !           295: 
        !           296: -- Iteration 24 --
        !           297: -- With default argument --
        !           298: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           299: NULL
        !           300: -- With more arguments --
        !           301: Warning: array_merge_recursive(): Argument #1 is not an array in %s on line %d
        !           302: NULL
        !           303: Done

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