Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.40.2]

- Fix var_export so that keys are properly quoted.

## [1.40.0]

- Add Listen for Xdebug to debug panel.
Expand Down
2 changes: 1 addition & 1 deletion src/test/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ describe('PHP Debug Adapter', () => {
{
context: 'clipboard',
expression: '$anArray',
result: 'array (\n 0 => 1,\n test => 2,\n test2 => \n array (\n t => 123,\n ),\n)',
result: "array (\n 0 => 1,\n 'test' => 2,\n 'test2' => \n array (\n 't' => 123,\n ),\n)",
hasVariablesReference: false,
},
{ context: 'clipboard', expression: '$aBoolean', result: 'true', hasVariablesReference: false },
Expand Down
8 changes: 3 additions & 5 deletions src/varExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ export async function varExportProperty(property: xdebug.Property, indent: strin
displayValue = (
await Promise.all(
properties.map(async property => {
const name = /^-?[0-9]+$/.test(property.name) ? `${property.name}` : `'${property.name}'`
const indent2 = indent + ' '
if (property.hasChildren) {
return `${indent2}${property.name} => \n${indent2}${await varExportProperty(
property,
indent2
)},`
return `${indent2}${name} => \n${indent2}${await varExportProperty(property, indent2)},`
} else {
return `${indent2}${property.name} => ${await varExportProperty(property, indent2)},`
return `${indent2}${name} => ${await varExportProperty(property, indent2)},`
}
})
)
Expand Down
Loading