php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44800 Returns empty value
Submitted: 2008-04-22 18:43 UTC Modified: 2008-04-22 21:01 UTC
From: citricacid at tlen dot pl Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.5 OS: Ubuntu 8.04 beta
Private report: No CVE-ID: None
 [2008-04-22 18:43 UTC] citricacid at tlen dot pl
Description:
------------
I try to preg_grep an array which contains some html strings. Each line is an array element.
If the expression string matches searched string from the beginnig to the end then everything is fine. If the expression string matches a substring then an empty value is returned.

Reproduce code:
---------------
Array - $templateArray:
[9]	<textarea name="senddata">
[10]	{ccms:textile}
[11]	</textarea><br />
[12]	<input type="hidden" value="{ccms:idmenu}" name="ccmsid" id="ccmsid">

Code:
$cml = preg_grep("/\{ccms:.+\}/", $templateArray)
echo "<pre>";
print_r($cml);
echo "</pre>";

Expected result:
----------------
Array
(
    [10] => {ccms:textile}
    [12] => <input type="hidden" value="{ccms:idmenu}" name="ccmsid" id="ccmsid">
)


Actual result:
--------------
Array
(
    [10] => {ccms:textile}
    [12] => 
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-22 18:54 UTC] citricacid at tlen dot pl
I was wrong. Sorry. Everything is fine. That value is invisible because it contains hidden html tag. Stupid me.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 28 22:01:27 2024 UTC