1--TEST-- 2explode() function 3--INI-- 4error_reporting=2047 5--SKIPIF-- 6<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64-bit only"); 7--FILE-- 8<?php 9/* From http://bugs.php.net/19865 */ 10echo var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE); 11echo "\n"; 12echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE)); 13echo "\n"; 14 15try { 16 var_dump(explode("", "")); 17} catch (\ValueError $e) { 18 echo $e->getMessage() . "\n"; 19} 20try { 21 var_dump(explode("", NULL)); 22} catch (\ValueError $e) { 23 echo $e->getMessage() . "\n"; 24} 25try { 26 var_dump(explode(NULL, "")); 27} catch (\ValueError $e) { 28 echo $e->getMessage() . "\n"; 29} 30 31var_dump(explode("a", "")); 32var_dump(explode("a", "a")); 33var_dump(explode("a", NULL)); 34try { 35 var_dump(explode(NULL, "a")); 36} catch (\ValueError $e) { 37 echo $e->getMessage() . "\n"; 38} 39var_dump(explode("abc", "acb")); 40var_dump(explode("somestring", "otherstring")); 41var_dump(explode("somestring", "otherstring", -1)); 42var_dump(explode("a", "aaaaaa")); 43var_dump(explode("==", str_repeat("-=".ord(0)."=-", 10))); 44var_dump(explode("=", str_repeat("-=".ord(0)."=-", 10))); 45////////////////////////////////////// 46var_dump(explode(":","a lazy dog:jumps:over:",-1)); 47var_dump(explode(":","a lazy dog:jumps:over", -1)); 48var_dump(explode(":","a lazy dog:jumps:over", -2)); 49var_dump(explode(":","a lazy dog:jumps:over:",-4)); 50var_dump(explode(":","a lazy dog:jumps:over:",-40000000000000)); 51var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-1)); 52var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-2)); 53?> 54--EXPECT-- 55array ( 56 0 => 'a', 57 1 => 'b' . "\0" . 'd', 58 2 => 'f', 59 3 => '1', 60 4 => 'd', 61) 62d6bee42a771449205344c0938ad4f035 63explode(): Argument #1 ($separator) cannot be empty 64explode(): Argument #1 ($separator) cannot be empty 65explode(): Argument #1 ($separator) cannot be empty 66array(1) { 67 [0]=> 68 string(0) "" 69} 70array(2) { 71 [0]=> 72 string(0) "" 73 [1]=> 74 string(0) "" 75} 76array(1) { 77 [0]=> 78 string(0) "" 79} 80explode(): Argument #1 ($separator) cannot be empty 81array(1) { 82 [0]=> 83 string(3) "acb" 84} 85array(1) { 86 [0]=> 87 string(11) "otherstring" 88} 89array(0) { 90} 91array(7) { 92 [0]=> 93 string(0) "" 94 [1]=> 95 string(0) "" 96 [2]=> 97 string(0) "" 98 [3]=> 99 string(0) "" 100 [4]=> 101 string(0) "" 102 [5]=> 103 string(0) "" 104 [6]=> 105 string(0) "" 106} 107array(1) { 108 [0]=> 109 string(60) "-=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=-" 110} 111array(21) { 112 [0]=> 113 string(1) "-" 114 [1]=> 115 string(2) "48" 116 [2]=> 117 string(2) "--" 118 [3]=> 119 string(2) "48" 120 [4]=> 121 string(2) "--" 122 [5]=> 123 string(2) "48" 124 [6]=> 125 string(2) "--" 126 [7]=> 127 string(2) "48" 128 [8]=> 129 string(2) "--" 130 [9]=> 131 string(2) "48" 132 [10]=> 133 string(2) "--" 134 [11]=> 135 string(2) "48" 136 [12]=> 137 string(2) "--" 138 [13]=> 139 string(2) "48" 140 [14]=> 141 string(2) "--" 142 [15]=> 143 string(2) "48" 144 [16]=> 145 string(2) "--" 146 [17]=> 147 string(2) "48" 148 [18]=> 149 string(2) "--" 150 [19]=> 151 string(2) "48" 152 [20]=> 153 string(1) "-" 154} 155array(3) { 156 [0]=> 157 string(10) "a lazy dog" 158 [1]=> 159 string(5) "jumps" 160 [2]=> 161 string(4) "over" 162} 163array(2) { 164 [0]=> 165 string(10) "a lazy dog" 166 [1]=> 167 string(5) "jumps" 168} 169array(1) { 170 [0]=> 171 string(10) "a lazy dog" 172} 173array(0) { 174} 175array(0) { 176} 177array(2) { 178 [0]=> 179 string(10) "a lazy dog" 180 [1]=> 181 string(11) "jumps::over" 182} 183array(1) { 184 [0]=> 185 string(10) "a lazy dog" 186} 187