php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42329 preg_replace returns null
Submitted: 2007-08-17 15:24 UTC Modified: 2007-08-17 15:30 UTC
From: grok at no-log dot org Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.3 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: grok at no-log dot org
New email:
PHP Version: OS:

 

 [2007-08-17 15:24 UTC] grok at no-log dot org
Description:
------------
preg_replace returns null instead of a string. 
The input is an html file I was parsing. 
The bug disapears when I change the file in many ways. 
I managed to reduce the html file's size a bit, but it is still too long to paste hear, and the posting might remove caracters that might be involved in the bug.

I put the html file here: http://marcel.demosphere.fr/php-preg-bug.txt



Reproduce code:
---------------
var_dump(preg_replace('@^.*</head>@s','',file_get_contents("bug")));

Expected result:
----------------
preg_replace should return a string with all of the input.

Actual result:
--------------
preg_replace returns null

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-17 15:30 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Check preg_last_error().
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 11:01:29 2024 UTC