[xdebug-dev] Bug 0000229: Cannot change a string to one which has spaces in it.

From: <noreply[@]lists.xdebug.org>
Date: Tue, 19 Dec 2006 18:58:11 +0100

The following bug has been CLOSED
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000229
======================================================================
Reporter: d_kelsey
Handler: derick
======================================================================
Project: Xdebug
Bug ID: 229
Category: Usage problems
Reproducibility: always
Severity: minor
Priority: normal
Status: closed
Operating System:
PHP Version: 5.1.6
Xdebug Version: 2.0.0rc1
======================================================================
Date Submitted: 2006-12-12 15:59 CET
Last Modified: 2006-12-19 18:58 CET
======================================================================
Summary: Cannot change a string to one which has spaces in it.
Description:
I attempt to change a variable containing a string (the string is
arbitrary) using the property_set request to a string which contains
spaces, but it fails. I can change the string to anything else so long as
it has no spaces in it.

eg I have a string with the contents "Welcome to PHP", and I tried to
change it to "This is", but it is rejected. The command issued is

property_set -i 189 -n $b -d 0 -l 12 -- VGhpcyBpcw==

<?xml version="1.0" encoding="iso-8859-1"?>
<response command="property_set" transaction_id="189"
success="0"></response>

If I change it to "ThisIsI" then the command is
property_set -i 193 -n $b -d 0 -l 12 -- VGhpc0lzSQ==

<?xml version="1.0" encoding="iso-8859-1"?>
<response command="property_set" transaction_id="193"
success="1"></response>

I have checked that the base64 encoding decodes correctly to a string with
spaces.
======================================================================

----------------------------------------------------------------------
 derick - 2006-12-12 22:28 CET
----------------------------------------------------------------------
Although property_set still needs some work, this is expected behavior.
Send the variable with quotes around it and it will work just fine.
Basically, Xdebug does internally:

$cmd = sprintf("%s = %s", $name, $data);
eval($cmd);

where $name is the -n option and $data the -- option. As you can see that
without the "'s, the eval command is not valid. I will keep this report
open though as a reminder to properly implement property_set.

----------------------------------------------------------------------
 d_kelsey - 2006-12-13 18:24 CET
----------------------------------------------------------------------
Thanks Derick, I have changed my client as you suggest and it works fine.

----------------------------------------------------------------------
 derick - 2006-12-19 18:58 CET
----------------------------------------------------------------------
That has been fixed in CVS now. If you use the -t argument Xdebug will
*not* use eval, but install just set the variable. You don't need to
escape strings with " then any more. Only in case where the -t argument is
missing Xdebug will use eval() internally to set the property.

Bug History
Date Modified Username Field Change
======================================================================
2006-12-12 15:59d_kelsey New Bug
2006-12-12 15:59d_kelsey Bug Monitored: d_kelsey
2006-12-12 22:28derick Bugnote Added: 0000520
2006-12-12 22:28derick Assigned To => derick
2006-12-12 22:28derick Status new => assigned
2006-12-13 18:24d_kelsey Bugnote Added: 0000521
2006-12-19 18:58derick Bugnote Added: 0000522
2006-12-19 18:58derick Status assigned => closed
======================================================================
Received on Tue Dec 19 2006 - 18:58:21 GMT

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST