php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27190 bug in stripslashes function with \0
Submitted: 2004-02-09 04:42 UTC Modified: 2004-02-09 11:38 UTC
From: tohar at sphera dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.4 OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tohar at sphera dot com
New email:
PHP Version: OS:

 

 [2004-02-09 04:42 UTC] tohar at sphera dot com
Description:
------------
When using stripslashes function on a string with \0, the 0 character which should have returned, doesnt returned!!!

Reproduce code:
---------------
<?
$x1 = 'a\b\c\22\0||TYPE';

$x2 = 'a\b\c\22\13||TYPE';

echo stripslashes($x1);
echo "<BR>";
echo stripslashes($x2);
?>

Expected result:
----------------
abc220||TYPE
abc2213||TYPE

Actual result:
--------------
abc22||TYPE
abc2213||TYPE

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-09 05:28 UTC] andrey@php.net
Next time use var_dump() which is better. Looks like \0 is intepreted as NULL byte.
<?php
$x1 = 'a\b\c\22\0||TYPE';

$x2 = 'a\b\c\22\13||TYPE';

var_dump(stripslashes($x1));
echo "\n";
var_dump(stripslashes($x2));
echo "\n";
?>
Output :
string(12) "abc22||TYPE"

string(13) "abc2213||TYPE"

 [2004-02-09 05:37 UTC] sniper@php.net
And that's what it is..no bug here.

 [2004-02-09 11:38 UTC] derick@php.net
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

See also docs foor addslashes and stripslashes.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC