Bug #74132 [NEW]: preg_match_all return value error.
| From: | liyan at bianhua8 dot com | Date: | Mon, 20 Feb 2017 04:15:05 +0000 |
| Subject: | Bug #74132 [NEW]: preg_match_all return value error. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207449@lists.php.net to get a copy of this message | ||
From: liyan at bianhua8 dot com
Operating system: ubuntu
PHP version: 7.1Git-2017-02-20 (Git)
Package: PCRE related
Bug Type: Bug
Bug description:preg_match_all return value error.
Description:
------------
after call preg_match_all function.
the third parameter $matches matched a array.
but the return value is false.
Test script:
---------------
<?php
$content = '<th class="title">
<div class="subject">
<a href="158391487256182472-1-1.html"
title="Jomashopï¼Swarovski"></a>
</div>
</th>
<td class="author">
<a href="profile-42357964-1.html"
title="author"><span>cat</span></a>
<span>2017-02-16</span>
</td>
<div class="link0 list-side-hd moderator-noborder obj2subject"><h3
class="fl"></h3></div><ul class="list-side-bd list-recommend
list-recommend2 link1"><li><a target="_blank"
href="//go.cqmmgo.com/forum-462505-thread-94061456905358538-1-1.html"><img
width="120" height="160" title="#" alt="#"
src="//att3.citysbs.com/120x120/chongqing/2016/03/09/09/160x120-092826_v2_11861457486906377_58b326482e2aa1f1da0f8455ac42187f.jpg"></a></li><li><a
target="_blank"
href="//go.cqmmgo.com/forum-462505-thread-179021457000027333-1-1.html"><img
width="120" height="160" title="#" alt="#"
src="//att3.citysbs.com/120x120/chongqing/2016/03/09/09/160x120-092826_v2_20771457486906773_31eb80d49e9ef06418003e577cc1453f.jpg"></a></li><li><a
target="_blank"
href="//go.cqmmgo.com/forum-462505-thread-93091456983256969-1-1.html"><img
width="120" height="160" title="#" alt="#"
src="//att3.citysbs.com/120x120/chongqing/2016/03/09/09/160x120-092827_v2_20231457486907098_05bc3d4608c961af0660722e03049e20.jpg"><span>abc</span></a></li><li><a
target="_blank"
href="//go.cqmmgo.com/forum-462505-thread-13801456844284137-1-1.html"><img
width="120" height="160" title="#" alt="#"
src="//att3.citysbs.com/120x120/chongqing/2016/03/09/09/160x120-092827_v2_14121457486907436_d49c002ba8675553c5436e80f305aca7.jpg"><span>xxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span></a></li></ul></div>';
$ret =
preg_match_all('/subject[\s\S]+?href="(.+?)"[\s\S]+?title="([\s\S]+?)"[\s\S]+?profile/',
$content, $matches);
var_dump($matches); // have array result
var_dump($ret); // bug the return value is false
--
Edit bug report at https://bugs.php.net/bug.php?id=74132&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74132&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74132&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74132&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74132&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74132&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74132&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74132&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74132&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74132&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74132&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74132&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74132&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74132&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74132&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74132&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74132&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74132&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74132&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74132&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74132&r=mysqlcfg