ID:               25042
 Updated by:       [EMAIL PROTECTED]
 Reported By:      michiel at tincan dot co dot uk
-Status:           Open
+Status:           Bogus
 Bug Type:         PCRE related
 Operating System: Linux
 PHP Version:      4.3.2
 New Comment:

Try increasing your error_reporting level:

Warning: preg_replace(): Parameter mismatch, pattern is a string while
replacement in an array. 


Previous Comments:
------------------------------------------------------------------------

[2003-08-11 09:44:55] michiel at tincan dot co dot uk

Description:
------------
When upgrading to 4.3.2 this started to happen:

whenever I use

$string = preg_replace("/\[$pattern\]/",$replacement,$string)

and the $pattern is empty or does not exist, but the replacement is an
array, my string is made empty.


'. /configure' '--prefix= /usr /local' '--with-apxs= /usr /local
/apache-1.3.27 /bin /apxs' '--with-config-file-path= /etc'
'--with-mysql= /usr' '--with-ldap' '--enable-sysvshm=yes'
'--enable-sysvsem=yes' '--with-gd= /usr' '--with-gettext' '--with-xml'
'--with-imap' '--enable-sockets' '--enable-ftp' '--with-regex=system'
'--enable-track-vars=yes' '--enable-force-cgi-redirect=yes'
'--enable-memory-limit=yes' '--enable-debug=no'

Register Globals is "on"

Reproduce code:
---------------
  $data = array(
    "field1" => "somevalue",
    "field2" => array("hmm","whassup"),
  );

  $html = '<b>[field1]</b>
  ,<h1>[field3]</h1>';

  while (list($field,$fielddata) = each ($data)) {
    $html = preg_replace("/\[$field\]/",$fielddata,$html);
  }
  print $html;
# will print nothing. however if you comment out the line "field2" etc
above, it will print something


Expected result:
----------------
output should be :
<b>somevalue</b>
, <h1>[field3]</h1>

Actual result:
--------------
no output, the string $html is empty


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25042&edit=1

Reply via email to