Bug #66494 [Fbk->Csd]: preg_match not working as expected
Edit report at https://bugs.php.net/bug.php?id=66494&edit=1
ID: 66494
User updated by: daniuf at gmail dot com
Reported by: daniuf at gmail dot com
Summary: preg_match not working as expected
-Status: Feedback
+Status: Closed
Type: Bug
Package: PCRE related
Operating System: CentOS release 5.10 (Final)
PHP Version: 5.4.24
Block user comment: N
Private report: N
New Comment:
It works when I execute "php -f filename.php" on command line. Thought still not working
with web access I'm closing down the ticket.
Thanks anyway!
Previous Comments:
------------------------------------------------------------------------
[2014-01-19 14:54:04] felipe@php.net
This makes no sense, what about using /.+/ pattern for testing?
------------------------------------------------------------------------
[2014-01-16 14:43:12] daniuf at gmail dot com
Hi requinix.
Thanks for the quick response. Unfortunately, nothing's been omitted.
------------------------------------------------------------------------
[2014-01-16 04:12:33] requinix@php.net
Works fine for me too. You're saying that if you execute that exact code with your 5.4.24 it
doesn't work? Nothing's been omitted?
------------------------------------------------------------------------
[2014-01-16 04:01:36] daniuf at gmail dot com
Description:
------------
When trying to use preg_match I'm not getting the expected result. As you can see, $chiche var
should have one element, and it's empty. I've tested same script with version 5.3.3 and
works perfectly fine. Also, I'm not getting any error, although I've setted up
error_reporting(E_ALL).
Best regards!
Test script:
---------------
<?php
error_reporting(E_ALL);
$res = "hola";
$res = preg_match("/hola/", $res, $chiche);
var_dump($chiche);
Expected result:
----------------
I expect to see :
array(1) {
[0]=>
string(4) "hola"
}
Actual result:
--------------
I see:
array(0) {
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66494&edit=1
Thread (5 messages)