From: peter dot bauwens at b-rail dot be
Operating system: Win XP SP1
PHP version: 4.3.10
PHP Bug Type: PCRE related
Bug description: PREG_SPLIT_DELIM_CAPTURE returns delimiter twice
Description:
------------
If you use preg_split with the PREG_SPLIT_DELIM_CAPTURE flag, the
delimiter is returned twice.
This bug also occurs in PHP 5.0.3.
I only added mssql and cpdf support in php.ini (has no relevance, I
think).
Reproduce code:
---------------
<?php
$From = "HR_PersFunUit LEFT JOIN HR_Pers ON HR_PersFunUit.IDNR =
HR_Pers.IDNR";
$Stukken = preg_split("/(( LEFT JOIN )|( RIGHT JOIN )|( INNER JOIN )|(
ON ))/", $From, -1, PREG_SPLIT_DELIM_CAPTURE);
print_r($Stukken);
?>
Expected result:
----------------
Array
(
[0] => HR_PersFunUit
[1] => LEFT JOIN
[2] => HR_Pers
[3] => ON
[4] => HR_PersFunUit.IDNR = HR_Pers.IDNR
)
Actual result:
--------------
Array
(
[0] => HR_PersFunUit
[1] => LEFT JOIN
[2] => LEFT JOIN
[3] => HR_Pers
[4] => ON
[5] =>
[6] =>
[7] =>
[8] => ON
[9] => HR_PersFunUit.IDNR = HR_Pers.IDNR
)
--
Edit bug report at http://bugs.php.net/?id=31895&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31895&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31895&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31895&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31895&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31895&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31895&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31895&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31895&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31895&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31895&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31895&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31895&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31895&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31895&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31895&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31895&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31895&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31895&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31895&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31895&r=mysqlcfg