php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16180 ereg_replace() a chr() doesn't work
Submitted: 2002-03-20 06:04 UTC Modified: 2002-03-20 10:50 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: marcel at daxy dot net Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 3.0.18 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marcel at daxy dot net
New email:
PHP Version: OS:

 

 [2002-03-20 06:04 UTC] marcel at daxy dot net
Version: php-3.0.18

<?
$string = "line 1" . chr(10) . "line 2";
$string = ereg_replace(chr(10),"<BR>",$string);
echo $string;
?>

This display's "line 1<BR>" in the source.

This has been fixed in PHP4 and in the Debian php3-package, however not in the source of PHP3. The folowing patch solves the problem (Submited in news://debian.bugs.dist on 2001-09-10 by Daniel Crettol):

/* Begin patch */

diff -Naur php3-3.0.18/regex/regex.h php3-3.0.18.new/regex/regex.h
--- php3-3.0.18/regex/regex.h   Fri Nov 12 21:57:49 1999
+++ php3-3.0.18.new/regex/regex.h       Mon Sep 10 22:08:24 2001
@@ -12,7 +12,7 @@
 #define API_EXPORT(type)    type
 #endif
 
-typedef off_t regoff_t;
+typedef int regoff_t;
 typedef struct {
        int re_magic;
        size_t re_nsub;         /* number of parenthesized subexpressions */

/* End patch */

I don't want to take credit for this patch, but just want it to be reported/fixed ;)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-20 06:06 UTC] marcel at daxy dot net
Version update...
 [2002-03-20 10:50 UTC] sniper@php.net
The version of PHP that this bug was reported in is too old. Please
try to reproduce this bug in the latest version of PHP (available
from http://www.php.net/downloads.php

If you are still able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".

PHP 3 is not supported anymore. Upgrade to PHP 4.1.2.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 21:01:23 2020 UTC