Version
v23.6.1
Platform
Microsoft Windows NT 10.0.26100.0 x64
Subsystem
No response
What steps will reproduce the bug?
Hi,
I would like to report a bug, it can be reproduced by running the PoC below:
function test(value) {
for (var x in this) {
}
JSON.stringify(this);
var obj = {};
Object.defineProperty(obj, "x", {
get: function () {
return "42";
},
configurable: false,
});
console.log(obj.x); // 42
}
test(0);
Regards,
Kevin
How often does it reproduce? Is there a required condition?
It can be reproduced anytime by simply running the given PoC on the given Node.js version.
What is the expected behavior? Why is that the expected behavior?
Prints 42
Deno and Bun runtimes solved the problem of Converting circular structure to JSON
TypeError is only given by NodeJS
What do you see instead?
JSON.stringify(this);
^
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'global'
--- property 'global' closes the circle
at JSON.stringify (<anonymous>)
at test (D:\HIWI\v8x10_05_03\reduced_20_03_2025\to_report_chunk65_round3_cluster8.js:9:8)
at Object.<anonymous> (D:\HIWI\v8x10_05_03\reduced_20_03_2025\to_report_chunk65_round3_cluster8.js:19:1)
at Module._compile (node:internal/modules/cjs/loader:1739:14)
at Object..js (node:internal/modules/cjs/loader:1904:10)
at Module.load (node:internal/modules/cjs/loader:1473:32)
at Function._load (node:internal/modules/cjs/loader:1285:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:151:5)
Node.js v23.6.1
Additional information
No response
Version
v23.6.1
Platform
Subsystem
No response
What steps will reproduce the bug?
Hi,
I would like to report a bug, it can be reproduced by running the PoC below:
Regards,
Kevin
How often does it reproduce? Is there a required condition?
It can be reproduced anytime by simply running the given PoC on the given Node.js version.
What is the expected behavior? Why is that the expected behavior?
Prints 42
Deno and Bun runtimes solved the problem of Converting circular structure to JSON
TypeError is only given by NodeJS
What do you see instead?
Additional information
No response