php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #373 ereg_replace() doesn't behave as in 2.0
Submitted: 1998-05-12 15:08 UTC Modified: 1998-05-13 03:24 UTC
From: steve at eyekon dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0 Release Candidate 4 OS: Solaris 2.6
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: steve at eyekon dot com
New email:
PHP Version: OS:

 

 [1998-05-12 15:08 UTC] steve at eyekon dot com
I have compiled Apache and PHP3 with hs regex support. The 
problem is when I try to replace the ascii character 013 with <br>, as listed in the PHP2 manual

This is the way the function is being used:

<? print(ereg_replace(013,"<br>",$message)); ?>

The result of this is the same message as submitted, not the converted message.

I looked in the view source of the bug database and I notice that the same use has been applied, but instead it
uses ereg_replace(13,"<br>",$message) without the 0. 

Should the code for ctl-m be 013, or 13?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-05-13 03:24 UTC] andi
When you prefix a number with a zero, you're specifying an octal
value--which means that you're replacing vertical tabs with '<br>'.
So you should be using 13.

BTW, for this particular task, you might want to check out the
function nl2br(), which does this for you.


Cheers,

Torben


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 04:01:31 2024 UTC