ID:               20528
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Verified
+Status:           Closed
 Bug Type:         PCRE related
 Operating System: win32 and linux
 PHP Version:      4.3.0-dev/4.4.0-dev
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2002-11-20 19:15:59] [EMAIL PROTECTED]

SUMMARY: preg_split incorrectly drops the first character of the last
element of the array it creates, at least in some circumstances. The
equivalent Perl code works correctly, and drops no characters.

[the following stuff has been copied from my comment to Bug #15413,
which I cannot re-open as I am not the owner]

The following code splits and re-joins a string - it should produce the
original string but doesn't.

$foo = '(#11/19/2002#)';   // MS Access date constant
$bar = preg_split('/\b/',$foo);
$baz = join('',$bar);
print $baz;

result is: (#11/19/2002)

The trailing hash character (#) is being dropped.

I tried the equivalent program in Perl (see below) and it produces the
*correct* result - so it is not a problem with the regex itself.

(Perl source:)
$foo = '(#11/19/2002#)';   # MS Access date constant
@bar = split(/\b/,$foo);
$baz = join('',@bar);
print $baz;

result is: (#11/19/2002#)

I have experienced this problem on Win32 with PHP 4.2.3 and 4.1.2, and
on Linux with PHP 4.04pl1 (RH7.1). The equivalent Perl code works
correctly on both Win32 (Perl 5.6.1) and Linux (Perl 5.6.0).

[NOTE: the person who originally reported this bug provided a much more
complicated example. Apart from his and my examples, I don't know if
any other circumstances can trigger this bug.]

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=20528&edit=1

Reply via email to