#50608 [Opn->Bgs]: last "<" character drops rest of the field with explode and preg_splits the

From: Date: Wed, 30 Dec 2009 00:30:51 +0000
Subject: #50608 [Opn->Bgs]: last "<" character drops rest of the field with explode and preg_splits the
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146200@lists.php.net to get a copy of this message
ID: 50608 Updated by: johannes@php.net Reported By: dlazesz at walla dot com -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Ubuntu 9.10, Debian 4.0 PHP Version: 5.2.12 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Use your browser's View source function or the command line for a test - the <> is treated like HTML by your browser ... Previous Comments: ------------------------------------------------------------------------ [2009-12-29 23:34:30] dlazesz at walla dot com Description: ------------ last "<" character drops the rest of the field with explode and preg_split Reproduce code: --------------- print_r(explode(",",'"Foo Bar" <foobar@example.com>, Second address...')); print_r(preg_split("/,/",'"Foo Bar" <foobar@example.com>, Second address...')); print_r(explode(",",'"Foo Bar" foobar@example.com>, Works.')); print_r(preg_split("/,/",'"Foo Bar" foobar@example.com>, Works.')); print_r(explode(",",'"Foo Bar" <<foobar@example.com>, Something missing.')); print_r(preg_split("/,/",'"Foo Bar" <<foobar@example.com>, Something missing.')); Expected result: ---------------- Array ( [0] => "Foo Bar" <foobar@example.com> [1] => Second address... ) Array ( [0] => "Foo Bar" <foobar@example.com> [1] => Second address... ) Array ( [0] => "Foo Bar" foobar@example.com> [1] => Works. ) Array ( [0] => "Foo Bar" foobar@example.com> [1] => Works. ) Array ( [0] => "Foo Bar" <foobar@example.com> [1] => Something missing. ) Array ( [0] => "Foo Bar" <foobar@example.com> [1] => Something missing. ) Actual result: -------------- Array ( [0] => "Foo Bar" [1] => Second address... ) Array ( [0] => "Foo Bar" [1] => Second address... ) Array ( [0] => "Foo Bar" foobar@example.com> [1] => Works. ) Array ( [0] => "Foo Bar" foobar@example.com> [1] => Works. ) Array ( [0] => "Foo Bar" < [1] => Something missing. ) Array ( [0] => "Foo Bar" < [1] => Something missing. ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50608&edit=1

« previous php.bugs (#146200) next »