1--TEST--
2Test stripos() function : usage variations - null terminated strings for 'haystack' argument
3--FILE--
4<?php
5/* Test stripos() function with null terminated strings for 'haystack' argument
6 *  in order to check the binary safe
7*/
8
9echo "*** Test stripos() function: binary safe ***\n";
10$haystacks = array(
11  "Hello".chr(0)."World",
12  chr(0)."Hello World",
13  "Hello World".chr(0),
14  chr(0).chr(0).chr(0),
15  "Hello\0world",
16  "\0Hello",
17  "Hello\0"
18);
19
20for($index = 0; $index < count($haystacks); $index++ ) {
21  var_dump( stripos($haystacks[$index], "\0") );
22  var_dump( stripos($haystacks[$index], "\0", $index) );
23}
24echo "*** Done ***";
25?>
26--EXPECT--
27*** Test stripos() function: binary safe ***
28int(5)
29int(5)
30int(0)
31bool(false)
32int(11)
33int(11)
34int(0)
35bool(false)
36int(5)
37int(5)
38int(0)
39bool(false)
40int(5)
41bool(false)
42*** Done ***
43