php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39646 preg_match not working over https with delcared array
Submitted: 2006-11-27 16:47 UTC Modified: 2010-01-28 04:38 UTC
From: noreply at test dot com Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: 5.2.0 OS: Windows XP
Private report: No CVE-ID: None
 [2006-11-27 16:47 UTC] noreply at test dot com
Description:
------------
Very oddly, preg_match does not seem to work in some cases over https:// while it works fine over http://

See:
https://208.97.159.12/test.php (doesn't work) vs.
http://208.97.159.12/test.php (does work).

Only occurs when array is declared implicitely in function, e.g. preg_match($pat, $class, $mat=array()) does not work on  https:// while preg_match($pat, $class, $mat) works on both https:// and http://







Reproduce code:
---------------
<? $class="C11"; ?>
<?
$pat = '/^(\D+)(\d+)$/';
if (!preg_match($pat, $class, $mat=array())) {
$notdigits='';
$digits = '';
} else {
print_r($mat);
}  
?>

Expected result:
----------------
Array ( [0] => C11 [1] => C [2] => 11 )

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-27 17:21 UTC] tony2001@php.net
preg_match() knows nothing about HTTP or HTTPS, there must be something else, that affect this behaviour (different data, for example).
 [2010-01-28 04:38 UTC] noreply at test dot com
Changing email.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Nov 28 05:03:12 2021 UTC