Doc #51568 [Opn->Csd]: Incorrect return value description for preg_filter
| From: | salathe@php.net | Date: | Fri, 16 Apr 2010 08:25:51 +0000 |
| Subject: | Doc #51568 [Opn->Csd]: Incorrect return value description for preg_filter | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4203@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51568&edit=1
ID: 51568
Updated by: salathe@php.net
Reported by: bcollecutt at gmail dot com
Summary: Incorrect return value description for preg_filter
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: salathe
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Thank you for the correction, it seems that description was borrowed
from
preg_replace. Note that preg_filter returns an empty array, rather than
NULL, if
no matches were found. Apologies for the typo in the change message (I
didn't fix
array_filter!).
Previous Comments:
------------------------------------------------------------------------
[2010-04-16 10:19:36] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=298066
Log: clarify array_filter return value with no matches, fixes bug #51568
------------------------------------------------------------------------
[2010-04-16 01:57:31] bcollecutt at gmail dot com
Description:
------------
Documentation for preg_filter incorrectly says
"If matches are found, the new subject will be returned, otherwise
subject will be
returned unchanged or NULL if an error occurred."
preg_filter returns NULL if no match is found. Not the unchanged string.
Test script:
---------------
$subject = "this is a test";
$pattern = "/cat/i";
if(is_null(preg_filter($pattern,'dog',$subject)))
echo "null";
else
echo "not null";
Expected result:
----------------
null
Actual result:
--------------
null
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51568&edit=1