Annotation of embedaddon/php/ext/mbstring/tests/mb_strpos_error2.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test mb_strpos() function : error conditions - Pass unknown encoding
        !             3: --SKIPIF--
        !             4: <?php
        !             5: extension_loaded('mbstring') or die('skip');
        !             6: function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
        !             7: ?>
        !             8: --FILE--
        !             9: <?php
        !            10: /* Prototype  : int mb_strpos(string $haystack, string $needle [, int $offset [, string $encoding]])
        !            11:  * Description: Find position of first occurrence of a string within another 
        !            12:  * Source code: ext/mbstring/mbstring.c
        !            13:  */
        !            14: 
        !            15: /*
        !            16:  * Pass an unknown encoding to mb_strpos() to test behaviour
        !            17:  */
        !            18: 
        !            19: echo "*** Testing mb_strpos() : error conditions ***\n";
        !            20: $haystack = 'Hello, world';
        !            21: $needle = 'world';
        !            22: $offset = 2;
        !            23: $encoding = 'unknown-encoding';
        !            24: 
        !            25: var_dump( mb_strpos($haystack, $needle, $offset, $encoding) );
        !            26: 
        !            27: echo "Done";
        !            28: ?>
        !            29: --EXPECTF--
        !            30: *** Testing mb_strpos() : error conditions ***
        !            31: 
        !            32: Warning: mb_strpos(): Unknown encoding "unknown-encoding" in %s on line %d
        !            33: bool(false)
        !            34: Done

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