php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6332 preg_replace does not abide by limit argument
Submitted: 2000-08-24 07:22 UTC Modified: 2000-08-24 09:25 UTC
From: jmoore@php.net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Latest CVS (24/08/2000) OS: Win32
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jmoore@php.net
New email:
PHP Version: OS:

 

 [2000-08-24 07:22 UTC] jmoore@php.net
Using Zeevs Build of RC1 on Win32 the preg_replace function either does not work as I expected or ignores limit, taking the example from the manual..

======= test.php =========
<?php
$html_body = "<hello><this><is><a><test>";
print preg_replace ("/(<\/?)(\w+)([^>]*>)/e", "'\\1'.strtoupper('\\2').'\\3'", $html_body, 2);
?> 
===========================

Expected Output:
<HELLO><THIS><is><a><test>

Actual output:
<HELLO><THIS><IS><A><TEST>

I suppose at least ignoreing it you dont get the same error as in pl2 where it gave wrong parameter count...

-James

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-24 09:25 UTC] andrei@php.net
Fixed in CVS, thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC