Bug 528162 - [Xdebug] property_set: unable to change array item value
Summary: [Xdebug] property_set: unable to change array item value
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP Debug CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-05 10:34 EST by Thierry BLIND CLA
Modified: 2020-05-14 11:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thierry BLIND CLA 2017-12-05 10:34:24 EST
Hi,
as discussed with Michele Locati while working on bug 519045 ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=519045#c10 ):

Using xdebug to update an array value ($b["baz qux"]) does not work at all:

<?php
$b['baz qux'] = 'ipsum';
?>

https://xdebug.org/docs-dbgp.php#property-get-property-set-property-value is not clear about how to handle arrays, for example:

property_set -t string -n $b["baz qux"] -d 0 -l 4 -- YQ==

will not work, neither will:

property_set -t string -n "$b[\"baz qux\"]" -d 0 -l 4 -- YQ==


Thank you to Michele for the following:
xdebug issue submitted: https://bugs.xdebug.org/view.php?id=1499
We need to wait until https://bugs.xdebug.org/view.php?id=1488 is fixed.


Thierry.
Comment 1 Dawid Pakula CLA 2020-01-09 17:46:41 EST
Issue has been fixed on Xdebug side. Can we move this forward?
Comment 2 Thierry BLIND CLA 2020-01-10 03:39:53 EST
Hi Dawid, I'll have a look into this one next days. I'll do some tests and if everything works as expected, I close the bug report.

Thierry.
Comment 3 Eclipse Genie CLA 2020-01-10 11:01:38 EST
New Gerrit change created: https://git.eclipse.org/r/155612
Comment 5 Thierry BLIND CLA 2020-01-11 11:23:46 EST
Should be fixed now.

I made my tests with Xdebug 2.6.0 (before Xdebug fixed the problem on their side, to check that I introduced no regressions) and Xdebug 2.9.0 under Windows, but not with older versions of Xdebug (or any other OS).

Xdebug >= 2.7.2 + upcoming PDT 7.1 should now be able to handle correctly array item value modifications.

If you see some regressions, please open a new bug report.

Thierry.
Comment 6 Thierry BLIND CLA 2020-01-11 11:31:21 EST
Additional note:
I made my tests using the strangest array keys possible, so for posterity, here are some of them ;)

<?php
$s = array(
    <<<'EOF'
        \0toto\'
        \$xxxxx''
        tutu\'\'
'\''\''''
    
EOF
    => 'u',
    <<<EOF
        \0toto2\'
        \$xxxxx''
        tutu\'\'
'\''\''''
    
EOF
    => 'v'
);

$b['$\$\$baz\0 ""\"\"\\ qux'] = 'ipsum';
$b["$\$\$baz\0 ''\'\'\\ qux"] = 'ipsum';

echo $b['$\$\$baz\0 ""\"\"\\ qux'] . PHP_EOL;
echo $b["$\$\$baz\0 ''\'\'\\ qux"] . PHP_EOL;
echo array_shift($s) . PHP_EOL;
echo array_shift($s) . PHP_EOL;
?>
Comment 7 Dawid Pakula CLA 2020-01-11 11:32:26 EST
Thank you. Can you update https://wiki.eclipse.org/PDT/NewIn71

Just create Debugger section ;)
Comment 8 Thierry BLIND CLA 2020-01-11 18:30:40 EST
(In reply to Dawid Pakula from comment #7)
> Thank you. Can you update https://wiki.eclipse.org/PDT/NewIn71
> 
> Just create Debugger section ;)

Ok I'll do that! :)

I also correct my previous comments, I confused myself testing many Xdebug versions:
- without this patch, PDT + Xdebug < 2.7.2 couldn't modify any value from any PHP variable. I don't know since how many Xdebug versions this feature didn't work anymore
- without this patch, PDT + Xdebug >= 2.7.2 can modify any value from any PHP variable, so long it's not a value inside an array.
- with this patch, PDT + Xdebug >= 2.7.2 can modify correctly any value from any PHP variable.
Comment 9 Dawid Pakula CLA 2020-01-11 18:50:40 EST
So if I good understand, we have value hot replace? ;)
Comment 10 Thierry BLIND CLA 2020-01-12 04:36:06 EST
(In reply to Dawid Pakula from comment #9)
> So if I good understand, we have value hot replace? ;)

Yes, at least basic hot replace using Xdebug >= 2.7.2 :)
It should have probably worked before, since all necessary code was written.
But I haven't tested it on object properties, because the debugger variable tab doesn't allow to unfold object properties.

Thierry.