Bug #68491 [Opn->Nab]: abount stripcslashes
| From: | requinix@php.net | Date: | Mon, 24 Nov 2014 22:15:53 +0000 |
| Subject: | Bug #68491 [Opn->Nab]: abount stripcslashes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188778@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68491&edit=1
ID: 68491
Updated by: requinix@php.net
Reported by: 328060173 at qq dot com
Summary: abount stripcslashes
-Status: Open
+Status: Not a bug
Type: Bug
Package: Strings related
Operating System: window 2010
PHP Version: 5.4.35
Block user comment: N
Private report: N
New Comment:
I can't say definitively since you haven't given much information, but it's probably
because your 5.2 setup had magic_quotes enabled (which adds slashes that you have to remove with
stripslashes()) and 5.4 does not have magic_quotes at all.
Previous Comments:
------------------------------------------------------------------------
[2014-11-24 11:06:36] 328060173 at qq dot com
Description:
------------
//Why the php5.4 does not require stripcslashes function, need and in PHP 5.2??
php 5.4
<?php
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Origin: *");
//è·å请æ±åæ°
$req = $_REQUEST["req"];
//廿忿
//$req = stripcslashes ( $req );
$arr = json_decode ( $req, true );
print_r($arr);
?>
php 5.2
php 5.4
<?php
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Origin: *");
//è·å请æ±åæ°
$req = $_REQUEST["req"];
//廿忿
//$req = stripcslashes ( $req );
$arr = json_decode ( $req, true );
print_r($arr);
?>
Test script:
---------------
http://localhost:8080?req={"test":"?","loc":"{"province":"hanzhou"}"}
php 5.4
<?php
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Origin: *");
//è·å请æ±åæ°
$req = $_REQUEST["req"];
//廿忿
//$req = stripcslashes ( $req );
$arr = json_decode ( $req, true );
print_r($arr);
?>
php 5.2
php 5.4
<?php
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Origin: *");
//è·å请æ±åæ°
$req = $_REQUEST["req"];
//廿忿
//$req = stripcslashes ( $req );
$arr = json_decode ( $req, true );
print_r($arr);
?>
Expected result:
----------------
return array
Actual result:
--------------
nothing return
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68491&edit=1