PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Valgrind Report for ext/pcre/tests/preg_replace_error1.phpt ('Test preg_replace() function : error - bad regular expressions')

Script

1: <?php
2:
/*
3: * proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
4: * Function is implemented in ext/pcre/php_pcre.c
5: */
6:
error_reporting(E_ALL&~E_NOTICE);
7:
/*
8: * Testing how preg_replace reacts to being passed the wrong type of regex argument
9: */
10:
echo "*** Testing preg_replace() : error conditions***\n";
11:
$regex_array = array('abcdef'//Regex without delimiter
12:
'/[a-zA-Z]'//Regex without closing delimiter
13:
'[a-zA-Z]/'//Regex without opening delimiter
14:
'/[a-zA-Z]/F', array('[a-z]'//Array of Regexes
15:
'[A-Z]''[0-9]'), '/[a-zA-Z]/'//Regex string
16:
);
17:
$replace 1;
18:
$subject 'a';
19: foreach(
$regex_array as $regex_value) {
20:     print 
"\nArg value is $regex_value\n";
21:     
var_dump(preg_replace($regex_value$replace$subject));
22: }
23:
$regex_value = new stdclass(); //Object
24:
var_dump(preg_replace($regex_value$replace$subject));
25:
?>
26:

Report

==29348== Conditional jump or move depends on uninitialised value(s)
==29348==    at 0x4140D72: ???
==29348==    by 0x13CDE1F7: ???
==29348==    by 0x13CDE1F7: ???
==29348==    by 0x13CDE1F8: ???
==29348==    by 0x1FFEFFBB3F: ???
==29348==    by 0x14F3443F: ???
==29348== 
==29348== Conditional jump or move depends on uninitialised value(s)
==29348==    at 0x4140A62: ???
==29348==    by 0x13CDE1F7: ???
==29348==    by 0x13CDE1F7: ???
==29348==    by 0x13CDE1F8: ???
==29348==    by 0x1FFEFFBB3F: ???
==29348==    by 0x14F3694F: ???
==29348== 

 

Generated at Sat, 09 Sep 2017 03:10:54 +0000 (14 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.