Doc #51864 [Opn->Csd]: preg_replace returns NULL on error
| From: | salathe@php.net | Date: | Tue, 08 Jun 2010 13:01:56 +0000 |
| Subject: | Doc #51864 [Opn->Csd]: preg_replace returns NULL on error | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4517@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51864&edit=1
ID: 51864
Updated by: salathe@php.net
Reported by: dscotese at litmocracy dot com
Summary: preg_replace returns NULL on error
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: PCRE related
Operating System: NA
PHP Version: Irrelevant
-Assigned To:
+Assigned To: salathe
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
I've added preg_last_error() to the "See Also" section of the following
functions:
preg_match, preg_match_all, preg_replace, preg_replace_all, and
preg_split. Is
that sufficient, or is there anything else that you were wanting?
Previous Comments:
------------------------------------------------------------------------
[2010-06-08 14:51:04] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=300271
Log: see also preg_last_error, doc bug #51864
- added preg_last_error see also link for preg_* functions
- also added other useful see-also links for preg funcs
------------------------------------------------------------------------
[2010-06-08 14:32:15] felipe@php.net
Re-open... Surely it must be documented.
------------------------------------------------------------------------
[2010-06-08 14:30:37] felipe@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
------------------------------------------------------------------------
[2010-05-20 16:04:05] dscotese at litmocracy dot com
Sorry I was not clear in my last post. This is a documentation problem.
No test script is necessary. Simply add a reference to preg_last_error
to the preg_replacement documentation.
However, when you call preg_replace with an array of patterns and
replacements, it can fail even though calling it with the corresponding
pairs of pattern/replacement one at a time does not fail. I'd consider
that a weakness, but not a bug.
If it's possible, preg_replace could be rewritten so that when it takes
arrays and fails in a way that doesn't indicate any bad patterns, it
tries to do the replacements one at a time. But that is not what this
bug report is about. I leave it to you to decide if preg_replace should
be made more robust in that way.
------------------------------------------------------------------------
[2010-05-20 14:31:28] mike@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=51864
--
Edit this bug report at http://bugs.php.net/bug.php?id=51864&edit=1