Skip to content

Commit cd5132d

Browse files
maglnetderickr
authored andcommitted
Issue #2382: Add test to show XML structure with double type property
1 parent 749ecb9 commit cd5132d

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

tests/debugger/bug02382.inc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
class User
3+
{
4+
public int $id;
5+
public User $subUser;
6+
}
7+
8+
$user = new User();
9+
$reflection = new ReflectionClass(User::class);
10+
$user->subUser = $reflection->newLazyProxy(function (User $user): User {
11+
return new User();
12+
});
13+
14+
var_dump($user);

tests/debugger/bug02382.phpt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
--TEST--
2+
Test for bug #2382: LazyProxyObject causes PHPStorm to drop out of debugging
3+
--SKIPIF--
4+
<?php
5+
require __DIR__ . '/../utils.inc';
6+
check_reqs('PHP >= 8.4; dbgp');
7+
?>
8+
--FILE--
9+
<?php
10+
require 'dbgp/dbgpclient.php';
11+
$filename = dirname(__FILE__) . '/bug02382.inc';
12+
13+
$commands = array(
14+
"breakpoint_set -t exception -x *",
15+
"breakpoint_set -t line -f file://{$filename} -n 14",
16+
'run',
17+
'property_get -n $user',
18+
'detach',
19+
);
20+
21+
dbgpRunFile( $filename, $commands );
22+
?>
23+
--EXPECTF--
24+
<?xml version="1.0" encoding="iso-8859-1"?>
25+
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file://bug02382.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>
26+
27+
-> breakpoint_set -i 1 -t exception -x *
28+
<?xml version="1.0" encoding="iso-8859-1"?>
29+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1" id="{{PID}}0001"></response>
30+
31+
-> breakpoint_set -i 2 -t line -f file://bug02382.inc -n 14
32+
<?xml version="1.0" encoding="iso-8859-1"?>
33+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2" id="{{PID}}0002"></response>
34+
35+
-> run -i 3
36+
<?xml version="1.0" encoding="iso-8859-1"?>
37+
<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://bug02382.inc" lineno="14"></xdebug:message></response>
38+
39+
-> property_get -i 4 -n $user
40+
<?xml version="1.0" encoding="iso-8859-1"?>
41+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="4"><property name="$user" fullname="$user" type="object" classname="User" children="1" numchildren="1" page="0" pagesize="32"><property name="subUser" fullname="$user-&gt;subUser" facet="public lazy-proxy" type="object" classname="User" children="0" numchildren="0"></property></property></response>
42+
43+
-> detach -i 5
44+
<?xml version="1.0" encoding="iso-8859-1"?>
45+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="detach" transaction_id="5" status="stopping" reason="ok"></response>

0 commit comments

Comments
 (0)