Bug #68932 [Opn->Nab]: error in explode with "\e..."

From: Date: Wed, 28 Jan 2015 15:55:28 +0000
Subject: Bug #68932 [Opn->Nab]: error in explode with "\e..."
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190273@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68932&edit=1 ID: 68932 Updated by: laruence@php.net Reported by: wborba dot dev at gmail dot com Summary: error in explode with "\e..." -Status: Open +Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: linux/debian PHP Version: 5.5Git-2015-01-28 (Git) Block user comment: N Private report: N 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 Previous Comments: ------------------------------------------------------------------------ [2015-01-28 14:44:16] cmbecker69 at gmx dot de This is not a bug in PHP, but rather a bug in your code, because you have unescaped backslashes in a string literal. You should always escape backslashes with a backslash: $arr = array( "controller" => "IDoc\\Home\\ecommerce", "request_method" => "POST" ); Anyhow, the code worked in PHP < 5.4.4, because neither \H nor \e were valid escape sequences, but since PHP 5.4.4 \e is a valid escape sequence for ESC. See also the PHP manual page "Strings": <http://php.net/manual/en/language.types.string.php>. ------------------------------------------------------------------------ [2015-01-28 12:35:16] wborba dot dev at gmail dot com Description: ------------ is simple, the code below works in version < 5.5, but version >= 5.5 does not work. $arr = array("controller" => "IDoc\Home\ecommerce","request_method" => "POST"); $x = $arr["controller"]; $y = explode("\\",$x); print_r($y); the result correct is... Array ( [0] => IDoc [1] => Home [2] => ecommerce ) but in php >= 5.5 is wrong... Array ( [0] => IDoc [1] => Homecommerce ) Test script: --------------- $arr = array("controller" => "IDoc\Home\ecommerce","request_method" => "POST"); $x = $arr["controller"]; $y = explode("\\",$x); print_r($y); Expected result: ---------------- Array ( [0] => IDoc [1] => Home [2] => ecommerce ) Actual result: -------------- Array ( [0] => IDoc [1] => Homecommerce ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68932&edit=1

« previous php.bugs (#190273) next »