#25042 [Bgs]: pattern emtpy and replacement array

From: Date: Wed, 13 Aug 2003 08:57:29 +0000
Subject: #25042 [Bgs]: pattern emtpy and replacement array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-45834@lists.php.net to get a copy of this message
ID: 25042 User updated by: michiel at tincan dot co dot uk Reported By: michiel at tincan dot co dot uk Status: Bogus Bug Type: PCRE related Operating System: Linux PHP Version: 4.3.2 New Comment: thanks. that's great. Just curious, was that already fixed, or did you fix it just now? Previous Comments: ------------------------------------------------------------------------ [2003-08-12 09:18:41] sniper@php.net With latest CVS snapshot, it errors out and doesn't do anything. ------------------------------------------------------------------------ [2003-08-12 09:12:20] michiel at tincan dot co dot uk Yes, exactly. It errors out and does nothing in the latter case. My bug is that it doesn't error out, but does something, ie it wipes the string. Sorry, maybe I don't get it, but I haven't been convinced about the bogus-ness of this bug yet. ------------------------------------------------------------------------ [2003-08-12 09:06:01] sniper@php.net From the friendly manual page for preg_replace(): "If pattern is an array and replacement is a string, then this replacement string is used for every value of pattern. The converse would not make sense, though." It errors out and does nothing in the latter case. ------------------------------------------------------------------------ [2003-08-12 04:12:38] michiel at tincan dot co dot uk Well, you may have tagged it bogus, but it's no use to have a "Warning", when the behaviour should be different. The pattern is not matched so regardless of the (type and value of the) replacement, the replacement should not take place. So I still think this is a bug. ------------------------------------------------------------------------ [2003-08-11 11:45:31] sniper@php.net Try increasing your error_reporting level: Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement in an array. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/25042 -- Edit this bug report at http://bugs.php.net/?id=25042&edit=1

« previous php.bugs (#45834) next »