php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31529 Can not escape Vars
Submitted: 2005-01-13 10:08 UTC Modified: 2005-01-14 10:17 UTC
From: david at 21stcd dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.8 OS: windows xp
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: david at 21stcd dot com
New email:
PHP Version: OS:

 

 [2005-01-13 10:08 UTC] david at 21stcd dot com
Description:
------------
The problem comes from the use of var substitution or addtion to strings that you are trying to "escape"

I find this problem when trying to create escaped hex strings to write data to sockets.


Reproduce code:
---------------
<?PHP
$hex  = "FF";
echo "\x$hex";
?>

Expected result:
----------------
?

Actual result:
--------------
\xFF

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-14 04:46 UTC] sniper@php.net
\x$ is not valid syntax.

 [2005-01-14 10:17 UTC] david at 21stcd dot com
even so "\x".$hex

will not work either.

It was my understanding you could subsitiute vars into strings using the previous method I outline, where as the on I just outlined add the vars value onto the end of the string.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 22 00:00:02 2025 UTC