View Issue Details

IDProjectCategoryView StatusLast Update
0002214XdebugTracingpublic2023-11-30 14:50
Reporterxwillq Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.2.2 
Target Version3.3devFixed in Version3.3.0 
Summary0002214: Array keys aren't escaped in traces
Description

Array keys aren't escaped in traces with machine readable format, which makes those traces hard to parse and breaks some existing scripts.

Steps To Reproduce
  1. Enable tracing with machine output
  2. Pass array with keys like '\n', '\r', etc. as function parameter
  3. See trace

Expected result:
Trace contains one function call per line with arguments escaped, so it would be easy to parse.

Actual result:
Line breaks are not expected, so they span multiple lines.

Additional Information

php -v output:
PHP 8.1.25 (cli) (built: Oct 28 2023 03:35:44) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.25, Copyright (c) Zend Technologies
with Zend OPcache v8.1.25, Copyright (c), by Zend Technologies
with Xdebug v3.2.2, Copyright (c) 2002-2023, by Derick Rethans

OS:
Docker image php:8.1-fpm-alpine3.17 on Docker Desktop for Macos.

This issue also appears in this version:
PHP 7.4.33 (cli) (built: Nov 12 2022 05:16:49) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
with Xdebug v3.1.6, Copyright (c) 2002-2022, by Derick Rethans

TagsNo tags attached.
Attached Files
example-script.php (120 bytes)   
<?php

function func(array $a) {
    return $a;
}

func([
    "\n" => "\n",
    "\r" => "\r",
    "\r\n" => "\r\n",
]);
example-script.php (120 bytes)   
example-output.xt (331 bytes)   
Version: 3.2.2
File format: 4
TRACE START [2023-11-23 17:37:15.878726]
1	0	0	0.002306	388720	{main}	1		/app/xdebug-test.php	0	0
2	1	0	0.002555	388720	func	1		/app/xdebug-test.php	8	1	['
' => '\n', '
' => '\r', '
' => '\r\n']
2	1	1	0.002721	388720
1	0	1	0.002817	388720
			0.003032	384760
TRACE END   [2023-11-23 17:37:15.879694]

example-output.xt (331 bytes)   
Operating System
PHP Version8.1.10-8.1.19

Activities

Issue History

Date Modified Username Field Change
2023-11-23 17:46 xwillq New Issue
2023-11-23 17:46 xwillq File Added: example-script.php
2023-11-23 17:46 xwillq File Added: example-output.xt
2023-11-29 17:37 derick Status new => confirmed
2023-11-29 17:37 derick Target Version => 3.3dev
2023-11-29 17:37 derick Note Added: 0006685
2023-11-29 18:01 derick Assigned To => derick
2023-11-29 18:01 derick Status confirmed => closed
2023-11-29 18:01 derick Resolution open => fixed
2023-11-29 18:01 derick Fixed in Version => 3.3dev
2023-11-30 14:50 derick Fixed in Version 3.3dev => 3.3.0