forked from xdebug/xdebug
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
230 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
class Foo | ||
{ | ||
public string $time_string { | ||
get { | ||
return $this->date->format('H:i:s'); | ||
} | ||
} | ||
|
||
public function __construct( | ||
public DateTime $date = new DateTime('1979-01-01 00:00:00') { | ||
set (string|DateTime $value) { | ||
if (is_string($value)) { | ||
$this->date = new DateTime($value); | ||
} else { | ||
$this->date = $value; | ||
} | ||
} | ||
} | ||
) | ||
{ | ||
} | ||
} | ||
|
||
$date = new DateTime('1980-01-01 00:00:00' ); | ||
|
||
$foo = new Foo(); | ||
var_dump($foo->date); | ||
$foo->date = '1970-01-01 12:34:56'; | ||
var_dump($foo->date); | ||
echo $foo->time_string; | ||
echo ''; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--TEST-- | ||
Test for bug #2314: Class properties with hooks are always shown as null [1] | ||
--SKIPIF-- | ||
<?php | ||
require __DIR__ . '/../utils.inc'; | ||
check_reqs('PHP >= 8.4; dbgp'); | ||
?> | ||
--FILE-- | ||
<?php | ||
require 'dbgp/dbgpclient.php'; | ||
$filename = dirname(__FILE__) . '/bug02314-001.inc'; | ||
|
||
$commands = array( | ||
'step_into', | ||
'breakpoint_set -t line -n 30', | ||
'run', | ||
'context_get -c 0', | ||
'property_get -c 0 -n $foo', | ||
'property_get -c 0 -n $foo->date', | ||
'detach', | ||
); | ||
|
||
dbgpRunFile( $filename, $commands ); | ||
?> | ||
--EXPECTF-- | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file://bug02314-001.inc" language="PHP" xdebug:language_version="" protocol_version="1.0" appid=""><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2099 by Derick Rethans]]></copyright></init> | ||
|
||
-> step_into -i 1 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="file://bug02314-001.inc" lineno="%d"></xdebug:message></response> | ||
|
||
-> breakpoint_set -i 2 -t line -n 30 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2" id="{{PID}}0001"></response> | ||
|
||
-> run -i 3 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="3" status="break" reason="ok"><xdebug:message filename="file://bug02314-001.inc" lineno="30"></xdebug:message></response> | ||
|
||
-> context_get -i 4 -c 0 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="4" context="0"><property name="$date" fullname="$date" type="object" classname="DateTime" children="1" numchildren="3" page="0" pagesize="32"><property name="date" fullname="$date->date" facet="public" type="string" size="26" encoding="base64"><![CDATA[MTk4MC0wMS0wMSAwMDowMDowMC4wMDAwMDA=]]></property><property name="timezone_type" fullname="$date->timezone_type" facet="public" type="int"><![CDATA[3]]></property><property name="timezone" fullname="$date->timezone" facet="public" type="string" size="3" encoding="base64"><![CDATA[VVRD]]></property></property><property name="$foo" fullname="$foo" type="object" classname="Foo" children="1" numchildren="2" page="0" pagesize="32"><property name="time_string" fullname="$foo->time_string" facet="public" type="string" size="8" encoding="base64"><![CDATA[MTI6MzQ6NTY=]]></property><property name="date" fullname="$foo->date" facet="public" type="object" classname="DateTime" children="1" numchildren="3"></property></property></response> | ||
|
||
-> property_get -i 5 -c 0 -n $foo | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="5"><property name="$foo" fullname="$foo" type="object" classname="Foo" children="1" numchildren="2" page="0" pagesize="32"><property name="time_string" fullname="$foo->time_string" facet="public" type="string" size="8" encoding="base64"><![CDATA[MTI6MzQ6NTY=]]></property><property name="date" fullname="$foo->date" facet="public" type="object" classname="DateTime" children="1" numchildren="3"></property></property></response> | ||
|
||
-> property_get -i 6 -c 0 -n $foo->date | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="6"><property name="$foo->date" fullname="$foo->date" type="object" classname="DateTime" children="1" numchildren="3" page="0" pagesize="32"><property name="date" fullname="$foo->date->date" facet="public" type="string" size="26" encoding="base64"><![CDATA[MTk3MC0wMS0wMSAxMjozNDo1Ni4wMDAwMDA=]]></property><property name="timezone_type" fullname="$foo->date->timezone_type" facet="public" type="int"><![CDATA[3]]></property><property name="timezone" fullname="$foo->date->timezone" facet="public" type="string" size="3" encoding="base64"><![CDATA[VVRD]]></property></property></response> | ||
|
||
-> detach -i 7 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="detach" transaction_id="7" status="stopping" reason="ok"></response> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
class Foo | ||
{ | ||
public string $time_string { | ||
get { | ||
return $this->date->format('H:i:s'); | ||
} | ||
} | ||
|
||
public function __construct( | ||
private DateTime $date = new DateTime('1979-01-01 00:00:00') { | ||
set (string|DateTime $value) { | ||
if (is_string($value)) { | ||
$this->date = new DateTime($value); | ||
} else { | ||
$this->date = $value; | ||
} | ||
} | ||
} | ||
) | ||
{ | ||
} | ||
|
||
function setNewDate( string|DateTime $date ) | ||
{ | ||
$this->date = $date; | ||
} | ||
} | ||
|
||
$date = new DateTime('1980-01-01 00:00:00' ); | ||
|
||
$foo = new Foo(); | ||
$foo->setNewDate( '1970-01-01 12:34:56' ); | ||
echo $foo->time_string; | ||
echo ''; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--TEST-- | ||
Test for bug #2314: Class properties with hooks are always shown as null [2] | ||
--SKIPIF-- | ||
<?php | ||
require __DIR__ . '/../utils.inc'; | ||
check_reqs('PHP >= 8.4; dbgp'); | ||
?> | ||
--FILE-- | ||
<?php | ||
require 'dbgp/dbgpclient.php'; | ||
$filename = dirname(__FILE__) . '/bug02314-002.inc'; | ||
|
||
$commands = array( | ||
'step_into', | ||
'breakpoint_set -t line -n 34', | ||
'run', | ||
'context_get -c 0', | ||
'property_get -c 0 -n $foo->date', | ||
'detach', | ||
); | ||
|
||
dbgpRunFile( $filename, $commands ); | ||
?> | ||
--EXPECTF-- | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file://bug02314-002.inc" language="PHP" xdebug:language_version="" protocol_version="1.0" appid=""><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2099 by Derick Rethans]]></copyright></init> | ||
|
||
-> step_into -i 1 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="1" status="break" reason="ok"><xdebug:message filename="file://bug02314-002.inc" lineno="%d"></xdebug:message></response> | ||
|
||
-> breakpoint_set -i 2 -t line -n 34 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2" id="{{PID}}0001"></response> | ||
|
||
-> run -i 3 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="3" status="break" reason="ok"><xdebug:message filename="file://bug02314-002.inc" lineno="34"></xdebug:message></response> | ||
|
||
-> context_get -i 4 -c 0 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="4" context="0"><property name="$date" fullname="$date" type="object" classname="DateTime" children="1" numchildren="3" page="0" pagesize="32"><property name="date" fullname="$date->date" facet="public" type="string" size="26" encoding="base64"><![CDATA[MTk4MC0wMS0wMSAwMDowMDowMC4wMDAwMDA=]]></property><property name="timezone_type" fullname="$date->timezone_type" facet="public" type="int"><![CDATA[3]]></property><property name="timezone" fullname="$date->timezone" facet="public" type="string" size="3" encoding="base64"><![CDATA[VVRD]]></property></property><property name="$foo" fullname="$foo" type="object" classname="Foo" children="1" numchildren="2" page="0" pagesize="32"><property name="time_string" fullname="$foo->time_string" facet="public" type="string" size="8" encoding="base64"><![CDATA[MTI6MzQ6NTY=]]></property><property name="date" fullname="$foo->date" facet="private" type="object" classname="DateTime" children="1" numchildren="3"></property></property></response> | ||
|
||
-> property_get -i 5 -c 0 -n $foo->date | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="5"><property name="$foo->date" fullname="$foo->date" type="object" classname="DateTime" children="1" numchildren="3" page="0" pagesize="32"><property name="date" fullname="$foo->date->date" facet="public" type="string" size="26" encoding="base64"><![CDATA[MTk3MC0wMS0wMSAxMjozNDo1Ni4wMDAwMDA=]]></property><property name="timezone_type" fullname="$foo->date->timezone_type" facet="public" type="int"><![CDATA[3]]></property><property name="timezone" fullname="$foo->date->timezone" facet="public" type="string" size="3" encoding="base64"><![CDATA[VVRD]]></property></property></response> | ||
|
||
-> detach -i 6 | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="detach" transaction_id="6" status="stopping" reason="ok"></response> |