|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-02-16 11:46 UTC] hirokawa@php.net
[2008-02-18 14:19 UTC] jmessa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 04:00:01 2025 UTC |
Description: ------------ When mb_ereg is passed certain data types as the $pattern argument it will return int(1), i.e. a successful match, when in fact it has not matched. This is shown by setting the $regs argument and looking at the returned array which only contains one element which is bool(false). Reproduce code: --------------- <?php $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++; }; ?> Expected result: ---------------- http://pastebin.com/f5f5c20ff Actual result: -------------- http://pastebin.com/f3f966bd0