Annotation of embedaddon/php/ext/standard/tests/strings/strncasecmp_variation7.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test strncasecmp() function : usage variations - binary safe
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : int strncasecmp ( string $str1, string $str2, int $len );
                      6:  * Description: Binary safe case-insensitive string comparison of the first n characters
                      7:  * Source code: Zend/zend_builtin_functions.c
                      8: */
                      9: 
                     10: /* Test strncasecmp() function with null terminated strings and binary values passed to 'str1' & 'str2' */
                     11: 
                     12: echo "*** Test strncasecmp() function: with null terminated strings and binary inputs ***\n";
                     13: 
                     14: /* A binary function should not expect a null terminated string, and it should treat input as a raw stream of data */
                     15: $str1 = "Hello\0world";
                     16: $str2 = "Hello\0";
                     17: $str3 = "Hello,".chr(0)."world";
                     18: var_dump( strncasecmp($str1, $str2, 12) );
                     19: var_dump( strncasecmp($str3, "Hello,world", 12) );
                     20: 
                     21: echo "*** Done ***\n";
                     22: ?>
                     23: --EXPECTF--
                     24: *** Test strncasecmp() function: with null terminated strings and binary inputs ***
                     25: int(5)
                     26: int(-119)
                     27: *** Done ***

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