1--TEST--
2Test strncasecmp() function : usage variations - binary safe
3--FILE--
4<?php
5/* Test strncasecmp() function with null terminated strings and binary values passed to 'str1' & 'str2' */
6
7echo "*** Test strncasecmp() function: with null terminated strings and binary inputs ***\n";
8
9/* A binary function should not expect a null terminated string, and it should treat input as a raw stream of data */
10$str1 = "Hello\0world";
11$str2 = "Hello\0";
12$str3 = "Hello,".chr(0)."world";
13var_dump( strncasecmp($str1, $str2, 12) );
14var_dump( strncasecmp($str3, "Hello,world", 12) );
15
16echo "*** Done ***\n";
17?>
18--EXPECT--
19*** Test strncasecmp() function: with null terminated strings and binary inputs ***
20int(5)
21int(-119)
22*** Done ***
23