#48196 [Opn->Ver]: Bug in string concatenation after calling preg_match_all()
| From: | jani@php.net | Date: | Sat, 09 May 2009 04:03:34 +0000 |
| Subject: | #48196 [Opn->Ver]: Bug in string concatenation after calling preg_match_all() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137013@lists.php.net to get a copy of this message | ||
ID: 48196
Updated by: jani@php.net
Reported By: saulo_gil at argentina dot com
-Status: Open
+Status: Verified
Bug Type: PCRE related
-Operating System: Windows XP
+Operating System: win32 only - Windows XP
-PHP Version: 5.2.9, 5.3.0RC2
+PHP Version: 5.*, 6CVS (2009-05-09)
New Comment:
Verified under windows. Does NOT happen with other OSes.
Previous Comments:
------------------------------------------------------------------------
[2009-05-09 01:18:28] saulo_gil at argentina dot com
Forgot to mention one thing, I've tried to reproduce this bug using the
PHP CLI, calling this script with php.exe -q <script.php>
I've just reproduced it again on a freshly installed XP box. Same
happened with PHP 5.2.9-2.
------------------------------------------------------------------------
[2009-05-08 23:26:18] felipe@php.net
I can't reproduce it.
------------------------------------------------------------------------
[2009-05-08 20:33:55] saulo_gil at argentina dot com
Description:
------------
If I try to perform a simple concatenation involving a variable created
from the matches output of preg_match_all() the resulting string is
borked. Please see the code above.
What I want to do: echo "[" . $var . "]";
Reproduce code:
---------------
<?
function foo($s)
{
preg_match_all("/PROCEDURE (.*)/i", $s, $matches);
$name = (string) $matches[1][0];
echo $name . "\n";
return "[" . $name . "]";
}
$s = "use providers
go
ALTER PROCEDURE SPD_EXECUTIVE_PROVIDER_DEALER
(
@EXECUTIVE_PROVIDER_ID KEY_ID,
@USER_SESSION_ID ID
)
/*
Procedimiento : SPD_EXECUTIVE_PROVIDER_DEALER";
echo foo($s);
?>
Expected result:
----------------
[SPD_EXECUTIVE_PROVIDER_DEALER]
Actual result:
--------------
]SPD_EXECUTIVE_PROVIDER_DEALER
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48196&edit=1