php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51892 preg_match_all forces the use of a $matches variable
Submitted: 2010-05-23 17:42 UTC Modified: 2010-05-23 18:13 UTC
From: hugo at ankarloo dot nu Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.13 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hugo at ankarloo dot nu
New email:
PHP Version: OS:

 

 [2010-05-23 17:42 UTC] hugo at ankarloo dot nu
Description:
------------
If you use preg_match_all and are only interested in the return value (i.e. you are not interested in the data stored in $matches) you are still forced to declare a variable for $matches.

I'm not sure if this is a bug in preg_match_all or in php's passed_by_reference.

My first thought was to pipe $matches to a php-equivalent of /dev/null, but something like that doesn't exist to my knowledge.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-23 18:13 UTC] degeberg@php.net
-Status: Open +Status: Bogus
 [2010-05-23 18:13 UTC] degeberg@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Use preg_match().

http://php.net/preg_match
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 14:01:33 2025 UTC