Skip to content

Commit 343115f

Browse files
committed
Merge branch 'xdebug_3_4'
2 parents 9f6c21d + c79284b commit 343115f

File tree

8 files changed

+234
-1
lines changed

8 files changed

+234
-1
lines changed

.azure/macos/php.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ steps:
3434
--enable-opcache \
3535
--prefix=/usr/local \
3636
--enable-sockets \
37+
--with-libxml \
38+
--enable-xml \
39+
--enable-dom \
40+
--enable-xmlreader \
3741
--with-zlib=/usr/local/opt/zlib \
3842
--with-config-file-path=/etc \
3943
--with-config-file-scan-dir=/etc/php.d

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
coverage: none
6565
ini-values: "session.save_path=/tmp"
6666
tools: pecl
67+
extensions: xmlreader
6768

6869
- name: Compile
6970
run: ./.build.scripts/compile.sh

src/lib/var.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ HashTable *xdebug_objdebug_pp(zval **zval_pp, int flags)
106106
EG(exception) = NULL;
107107

108108
tmp = zend_get_properties_for(&dzval, ZEND_PROP_PURPOSE_DEBUG);
109+
if (EG(exception)) {
110+
zend_clear_exception();
111+
}
109112

110113
XG_BASE(in_debug_info) = 0;
111114
xdebug_tracing_restore_trace_context(original_trace_context);

tests/debugger/bug02326-php83.phpt

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
--TEST--
2+
Test for bug #2326: Step debugger finishes if property debugging handler in PHP throws an exception (< PHP 8.4)
3+
--SKIPIF--
4+
<?php
5+
require __DIR__ . '/../utils.inc';
6+
check_reqs('PHP < 8.4; dbgp');
7+
?>
8+
--EXTENSIONS--
9+
dom
10+
xmlreader
11+
--FILE--
12+
<?php
13+
require 'dbgp/dbgpclient.php';
14+
$filename = dirname(__FILE__) . '/bug02326.inc';
15+
16+
$commands = array(
17+
'step_into',
18+
'stdout -c 1',
19+
'breakpoint_set -t line -n 12',
20+
'run',
21+
'context_get -c 0',
22+
'step_over',
23+
'context_get -c 0',
24+
'step_into',
25+
'context_get -c 0',
26+
'step_into',
27+
'detach',
28+
);
29+
30+
dbgpRunFile( $filename, $commands, [ 'extension' => [ 'dom', 'xmlreader' ] ] );
31+
?>
32+
--EXPECTF--
33+
<?xml version="1.0" encoding="iso-8859-1"?>
34+
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file://bug02326.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>
35+
36+
-> step_into -i 1
37+
<?xml version="1.0" encoding="iso-8859-1"?>
38+
<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://bug02326.inc" lineno="2"></xdebug:message></response>
39+
40+
-> stdout -i 2 -c 1
41+
<?xml version="1.0" encoding="iso-8859-1"?>
42+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="2" success="1"></response>
43+
44+
-> breakpoint_set -i 3 -t line -n 12
45+
<?xml version="1.0" encoding="iso-8859-1"?>
46+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="3" id="{{PID}}0001"></response>
47+
48+
-> run -i 4
49+
<?xml version="1.0" encoding="iso-8859-1"?>
50+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file://bug02326.inc" lineno="12"></xdebug:message></response>
51+
52+
-> context_get -i 5 -c 0
53+
<?xml version="1.0" encoding="iso-8859-1"?>
54+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="5" context="0"><property name="$err" fullname="$err" type="uninitialized"></property><property name="$reader" fullname="$reader" type="null"></property></response>
55+
56+
-> step_over -i 6
57+
<?xml version="1.0" encoding="iso-8859-1"?>
58+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="6" status="break" reason="ok"><xdebug:message filename="file://bug02326.inc" lineno="13"></xdebug:message></response>
59+
60+
-> context_get -i 7 -c 0
61+
<?xml version="1.0" encoding="iso-8859-1"?>
62+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="7" context="0"><property name="$err" fullname="$err" type="bool"><![CDATA[1]]></property><property name="$reader" fullname="$reader" type="object" classname="XMLReader" children="0" numchildren="0" page="0" pagesize="32"></property></response>
63+
64+
-> step_into -i 8
65+
<?xml version="1.0" encoding="iso-8859-1"?>
66+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file://bug02326.inc" lineno="17"></xdebug:message></response>
67+
68+
-> context_get -i 9 -c 0
69+
<?xml version="1.0" encoding="iso-8859-1"?>
70+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="9" context="0"><property name="$err" fullname="$err" type="bool"><![CDATA[1]]></property><property name="$reader" fullname="$reader" type="object" classname="XMLReader" children="0" numchildren="0" page="0" pagesize="32"></property></response>
71+
72+
-> step_into -i 10
73+
<?xml version="1.0" encoding="iso-8859-1"?>
74+
<stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[TmV4dCBsaW5lMQ==]]></stream>
75+
76+
<?xml version="1.0" encoding="iso-8859-1"?>
77+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="10" status="break" reason="ok"><xdebug:message filename="file://bug02326.inc" lineno="18"></xdebug:message></response>
78+
79+
-> detach -i 11
80+
<?xml version="1.0" encoding="iso-8859-1"?>
81+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="detach" transaction_id="11" status="stopping" reason="ok"></response>

tests/debugger/bug02326-php84.phpt

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
--TEST--
2+
Test for bug #2326: Step debugger finishes if property debugging handler in PHP throws an exception (>= PHP 8.4)
3+
--SKIPIF--
4+
<?php
5+
require __DIR__ . '/../utils.inc';
6+
check_reqs('PHP >= 8.4; dbgp');
7+
?>
8+
--EXTENSIONS--
9+
dom
10+
xmlreader
11+
--FILE--
12+
<?php
13+
require 'dbgp/dbgpclient.php';
14+
$filename = dirname(__FILE__) . '/bug02326.inc';
15+
16+
$commands = array(
17+
'step_into',
18+
'stdout -c 1',
19+
'breakpoint_set -t line -n 12',
20+
'run',
21+
'context_get -c 0',
22+
'step_over',
23+
'context_get -c 0',
24+
'step_into',
25+
'context_get -c 0',
26+
'step_into',
27+
'detach',
28+
);
29+
30+
dbgpRunFile( $filename, $commands, [ 'extension' => [ 'dom', 'xmlreader' ] ] );
31+
?>
32+
--EXPECTF--
33+
<?xml version="1.0" encoding="iso-8859-1"?>
34+
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file://bug02326.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>
35+
36+
-> step_into -i 1
37+
<?xml version="1.0" encoding="iso-8859-1"?>
38+
<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://bug02326.inc" lineno="2"></xdebug:message></response>
39+
40+
-> stdout -i 2 -c 1
41+
<?xml version="1.0" encoding="iso-8859-1"?>
42+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="2" success="1"></response>
43+
44+
-> breakpoint_set -i 3 -t line -n 12
45+
<?xml version="1.0" encoding="iso-8859-1"?>
46+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="3" id="{{PID}}0001"></response>
47+
48+
-> run -i 4
49+
<?xml version="1.0" encoding="iso-8859-1"?>
50+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file://bug02326.inc" lineno="12"></xdebug:message></response>
51+
52+
-> context_get -i 5 -c 0
53+
<?xml version="1.0" encoding="iso-8859-1"?>
54+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="5" context="0"><property name="$err" fullname="$err" type="uninitialized"></property><property name="$reader" fullname="$reader" type="null"></property></response>
55+
56+
-> step_over -i 6
57+
<?xml version="1.0" encoding="iso-8859-1"?>
58+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="6" status="break" reason="ok"><xdebug:message filename="file://bug02326.inc" lineno="13"></xdebug:message></response>
59+
60+
-> context_get -i 7 -c 0
61+
<?xml version="1.0" encoding="iso-8859-1"?>
62+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="7" context="0"><property name="$err" fullname="$err" type="bool"><![CDATA[1]]></property><property name="$reader" fullname="$reader" type="object" classname="XMLReader" children="1" numchildren="13" page="0" pagesize="32"><property name="attributeCount" fullname="$reader-&gt;attributeCount" facet="public" type="int"><![CDATA[0]]></property><property name="baseURI" fullname="$reader-&gt;baseURI" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="depth" fullname="$reader-&gt;depth" facet="public" type="int"><![CDATA[0]]></property><property name="hasAttributes" fullname="$reader-&gt;hasAttributes" facet="public" type="bool"><![CDATA[0]]></property><property name="hasValue" fullname="$reader-&gt;hasValue" facet="public" type="bool"><![CDATA[0]]></property><property name="isDefault" fullname="$reader-&gt;isDefault" facet="public" type="bool"><![CDATA[0]]></property><property name="localName" fullname="$reader-&gt;localName" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="name" fullname="$reader-&gt;name" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="namespaceURI" fullname="$reader-&gt;namespaceURI" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="nodeType" fullname="$reader-&gt;nodeType" facet="public" type="int"><![CDATA[0]]></property><property name="prefix" fullname="$reader-&gt;prefix" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="value" fullname="$reader-&gt;value" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="xmlLang" fullname="$reader-&gt;xmlLang" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property></property></response>
63+
64+
-> step_into -i 8
65+
<?xml version="1.0" encoding="iso-8859-1"?>
66+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file://bug02326.inc" lineno="17"></xdebug:message></response>
67+
68+
-> context_get -i 9 -c 0
69+
<?xml version="1.0" encoding="iso-8859-1"?>
70+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="9" context="0"><property name="$err" fullname="$err" type="bool"><![CDATA[1]]></property><property name="$reader" fullname="$reader" type="object" classname="XMLReader" children="1" numchildren="13" page="0" pagesize="32"><property name="attributeCount" fullname="$reader-&gt;attributeCount" facet="public" type="int"><![CDATA[0]]></property><property name="baseURI" fullname="$reader-&gt;baseURI" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="depth" fullname="$reader-&gt;depth" facet="public" type="int"><![CDATA[0]]></property><property name="hasAttributes" fullname="$reader-&gt;hasAttributes" facet="public" type="bool"><![CDATA[0]]></property><property name="hasValue" fullname="$reader-&gt;hasValue" facet="public" type="bool"><![CDATA[0]]></property><property name="isDefault" fullname="$reader-&gt;isDefault" facet="public" type="bool"><![CDATA[0]]></property><property name="localName" fullname="$reader-&gt;localName" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="name" fullname="$reader-&gt;name" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="namespaceURI" fullname="$reader-&gt;namespaceURI" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="nodeType" fullname="$reader-&gt;nodeType" facet="public" type="int"><![CDATA[0]]></property><property name="prefix" fullname="$reader-&gt;prefix" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="value" fullname="$reader-&gt;value" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="xmlLang" fullname="$reader-&gt;xmlLang" facet="public" type="string" size="0" encoding="base64"><![CDATA[]]></property></property></response>
71+
72+
-> step_into -i 10
73+
<?xml version="1.0" encoding="iso-8859-1"?>
74+
<stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[TmV4dCBsaW5lMQ==]]></stream>
75+
76+
<?xml version="1.0" encoding="iso-8859-1"?>
77+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="10" status="break" reason="ok"><xdebug:message filename="file://bug02326.inc" lineno="18"></xdebug:message></response>
78+
79+
-> detach -i 11
80+
<?xml version="1.0" encoding="iso-8859-1"?>
81+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="detach" transaction_id="11" status="stopping" reason="ok"></response>

tests/debugger/bug02326.inc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
$reader = null;
3+
function ReloadXmlFile($fname)
4+
{
5+
global $reader;
6+
$reader = new XMLReader();
7+
8+
$err = $reader->open($fname);
9+
return $err;
10+
}
11+
12+
$err = ReloadXmlFile(__DIR__ . "/bug02326.xml");
13+
if (!$err)
14+
{
15+
echo ("error");
16+
}
17+
echo ("Next line1");
18+
echo ("Next line2");
19+
?>

tests/debugger/bug02326.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0"?>
2+
<PurchaseOrder PurchaseOrderNumber="99503" OrderDate="1999-10-20">
3+
<Address Type="Shipping">
4+
<Name>Ellen Adams</Name>
5+
<Street>123 Maple Street</Street>
6+
<City>Mill Valley</City>
7+
<State>CA</State>
8+
<Zip>10999</Zip>
9+
<Country>USA</Country>
10+
</Address>
11+
<Address Type="Billing">
12+
<Name>Tai Yee</Name>
13+
<Street>8 Oak Avenue</Street>
14+
<City>Old Town</City>
15+
<State>PA</State>
16+
<Zip>95819</Zip>
17+
<Country>USA</Country>
18+
</Address>
19+
<DeliveryNotes>Please leave packages in shed by driveway.</DeliveryNotes>
20+
<Items>
21+
<Item PartNumber="872-AA">
22+
<ProductName>Lawnmower</ProductName>
23+
<Quantity>1</Quantity>
24+
<USPrice>148.95</USPrice>
25+
<Comment>Confirm this is electric</Comment>
26+
</Item>
27+
<Item PartNumber="926-AA">
28+
<ProductName>Baby Monitor</ProductName>
29+
<Quantity>2</Quantity>
30+
<USPrice>39.98</USPrice>
31+
<ShipDate>1999-05-21</ShipDate>
32+
</Item>
33+
</Items>
34+
</PurchaseOrder>

tests/debugger/dbgp/dbgpclient.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,17 @@ private function launchPhp( &$pipes, $filename, array $ini_options = [], array $
7676
$ini_options = array_merge( $default_options, $ini_options );
7777
foreach ( $ini_options as $key => $value )
7878
{
79-
$options .= " -d{$key}=$value";
79+
if ( is_array( $value ) )
80+
{
81+
foreach ( $value as $valueElement )
82+
{
83+
$options .= " -d{$key}=$valueElement";
84+
}
85+
}
86+
else
87+
{
88+
$options .= " -d{$key}=$value";
89+
}
8090
}
8191

8292
if ( array_key_exists( 'auto_prepend', $extra_options ) )

0 commit comments

Comments
 (0)