From: saulo_gil at argentina dot com
Operating system: Windows XP
PHP version: 5.3.0RC2
PHP Bug Type: *Regular Expressions
Bug description: Reproducible bug in string concatenation after calling
preg_match_all
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 bug report at http://bugs.php.net/?id=48196&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48196&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48196&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48196&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48196&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48196&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48196&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48196&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48196&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48196&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48196&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48196&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48196&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48196&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48196&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48196&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48196&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48196&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48196&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48196&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48196&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48196&r=mysqlcfg