File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
mbstring /
tests /
bug43994.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:47:57 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
Test mb_ereg() function : mb_ereg 'successfully' matching incorrectly
--SKIPIF--
<?php
extension_loaded('mbstring') or die('skip');
function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
?>
--FILE--
<?php
/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
* Description: Regular expression match for multibyte string
* Source code: ext/mbstring/php_mbregex.c
*/
/*
* mb_ereg 'successfully' matching incorrectly:
* Bug now seems to be fixed - error message is now generated when an 'empty'
* pattern is supplied to mb_ereg. Similar error message to ereg().
*/
$unset_var = 10;
unset ($unset_var);
$inputs = array(NULL, null, false, FALSE, "", '', @$undefined_var,
@$unset_var);
$iterator = 1;
foreach($inputs as $input) {
if(@is_array($mb_regs)){
$mb_regs = '';
}
echo "\n-- Iteration $iterator --\n";
echo "Without \$regs arg:\n";
var_dump( mb_ereg($input, 'hello, world') );
echo "With \$regs arg:\n";
var_dump(mb_ereg($input, 'hello, world', $mb_regs));
var_dump($mb_regs);
$iterator++;
};
?>
--EXPECTF--
-- Iteration 1 --
Without $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
With $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
NULL
-- Iteration 2 --
Without $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
With $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
NULL
-- Iteration 3 --
Without $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
With $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
NULL
-- Iteration 4 --
Without $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
With $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
NULL
-- Iteration 5 --
Without $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
With $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
NULL
-- Iteration 6 --
Without $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
With $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
NULL
-- Iteration 7 --
Without $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
With $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
NULL
-- Iteration 8 --
Without $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
With $regs arg:
Warning: mb_ereg(): empty pattern in %s on line %d
bool(false)
NULL
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>