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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 21:01:27 2025 UTC