php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42238 var_dump of preg_match array hangs script
Submitted: 2007-08-07 21:26 UTC Modified: 2007-08-08 12:58 UTC
From: redsandro at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.4RC1 OS: Linux / WinXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: redsandro at gmail dot com
New email:
PHP Version: OS:

 

 [2007-08-07 21:26 UTC] redsandro at gmail dot com
Description:
------------
When preg_matching a multiline string containing '<?', dumping the resulting $matches array hangs the script engine.

I've noticed the same in php 4.4.1 and 5.2.1.

Reproduce code:
---------------
<?php
echo '<pre>';
$var = "<? // <- Remove first two chars and this script won't hang.";
$pattern = "/^(.+)$/s";
preg_match($pattern, $var, $matches);
print_r($matches);
exit;


Expected result:
----------------
Array
(
    [0] =>  <? // <- Remove first two chars and this script won't hang.
    [1] =>  <? // <- Remove first two chars and this script won't hang.
)

Actual result:
--------------
Array
(

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-07 21:48 UTC] scottmac@php.net
When you know you have an older version at least try upgrading it before reporting a bug.

Can't reproduce though.
 [2007-08-08 12:58 UTC] redsandro at gmail dot com
I used php 5 like the website recommended 'cause there's no stable 6 release yet afaik.

Anyway, the bug is reproducable but is bogus. Aparrently, the output causes Opera to wait for and hide some code (looking like error), Firefox the same but not waiting for more, and IE displaying only the first line. Either case html *source* is fine.

It's a browser issue, not even an error. During my hours of confusion I didn't realise that. Sorry.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 04 08:00:01 2025 UTC