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