mirror of
https://github.com/php/php-src.git
synced 2025-01-22 03:34:19 +08:00
add tests for old bug reports
This commit is contained in:
parent
feba2edba2
commit
802e12674e
26
ext/pcre/tests/bug21758.phpt
Normal file
26
ext/pcre/tests/bug21758.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #27011: preg_replace_callback() not working with class methods
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
function foo() {
|
||||
|
||||
$s = 'preg_replace() is broken';
|
||||
|
||||
var_dump(preg_replace_callback(
|
||||
'/broken/',
|
||||
array(&$this, 'bar'),
|
||||
$s
|
||||
));
|
||||
}
|
||||
|
||||
function bar() {
|
||||
return 'working';
|
||||
}
|
||||
|
||||
} // of Foo
|
||||
|
||||
$o = new Foo;
|
||||
?>
|
||||
--EXPECT--
|
||||
string(25) "preg_replace() is working"
|
13
ext/pcre/tests/bug27011.phpt
Normal file
13
ext/pcre/tests/bug27011.phpt
Normal file
@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #27011: segfault in preg_match_all()
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(preg_match_all('|(\w+)://([^\s"<]*[\w+#?/&=])|', "This is a text string", $matches, PREG_SET_ORDER));
|
||||
var_dump($matches);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
array(0) {
|
||||
}
|
14
ext/pcre/tests/bug38600.phpt
Normal file
14
ext/pcre/tests/bug38600.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #38600: infinite loop in pcre with extended class
|
||||
--FILE--
|
||||
<?php
|
||||
$foo = 'bla bla bla';
|
||||
|
||||
var_dump(preg_match('/(?<!\w)(0x[\p{N}]+[lL]?|[\p{Nd}]+(e[\p{Nd}]*)?[lLdDfF]?)(?!\w)/', $foo, $m));
|
||||
var_dump($m);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(0)
|
||||
array(0) {
|
||||
}
|
Loading…
Reference in New Issue
Block a user