Annotation of embedaddon/php/ext/pcre/tests/preg_quote_error1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test preg_quote() function : error conditions - wrong arg types
3: --FILE--
4: <?php
5: /*
6: * proto string preg_quote(string str [, string delim_char])
7: * Function is implemented in ext/pcre/php_pcre.c
8: */
9: error_reporting(E_ALL&~E_NOTICE);
10: /*
11: * Testing how preg_quote reacts to being passed the wrong type of input argument
12: */
13: echo "*** Testing preg_quote() : error conditions ***\n";
14: $input = array('this is a string', array('this is', 'a subarray'),);
15: foreach($input as $value) {
16: print "\nArg value is: $value\n";
17: var_dump(preg_quote($value));
18: }
19: $value = new stdclass(); //Object
20: var_dump(preg_quote($value));
21: echo "Done";
22: ?>
23: --EXPECTF--
24: *** Testing preg_quote() : error conditions ***
25:
26: Arg value is: this is a string
27: string(16) "this is a string"
28:
29: Arg value is: Array
30:
31: Warning: preg_quote() expects parameter 1 to be string, array given in %spreg_quote_error1.php on line %d
32: NULL
33:
34: Warning: preg_quote() expects parameter 1 to be string, object given in %spreg_quote_error1.php on line %d
35: NULL
36: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>