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

1.1       misho       1: --TEST--
                      2: Test strncmp() function : usage variations - binary safe(null terminated strings)
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : int strncmp ( string $str1, string $str2, int $len );
                      6:  * Description: Binary safe case-sensitive string comparison of the first n characters
                      7:  * Source code: Zend/zend_builtin_functions.c
                      8: */
                      9: 
                     10: /* Test strncmp() function with binary values passed to 'str1' & 'str2' and with the null terminated strings */
                     11: 
                     12: echo "*** Test strncmp() function: Checking with the null terminated strings ***\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: var_dump( strncmp($str1, $str2, 12) );  //expected: int(5);
                     18: 
                     19: echo "*** Done ***\n";
                     20: ?>
                     21: --EXPECTF--
                     22: *** Test strncmp() function: Checking with the null terminated strings ***
                     23: int(5)
                     24: *** Done ***

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