1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 10:43:30 +02:00
Files
DanielEScherzer 618190127e Zend/tests: organize some tests with sub directories (8) (#17873)
Create new sub directories for tests related to backtraces and for tests
related to `$this` being reserved in different places and not being usable or
reassignable.

Work towards GH-15631
2025-02-22 19:10:59 +00:00

69 lines
1.1 KiB
PHP

--TEST--
Bug #76047: Use-after-free when accessing already destructed backtrace arguments
--FILE--
<?php
class Vuln {
public $a;
public function __destruct() {
unset($this->a);
$backtrace = (new Exception)->getTrace();
var_dump($backtrace);
}
}
function test($arg) {
$arg = str_shuffle(str_repeat('A', 79));
$vuln = new Vuln();
$vuln->a = $arg;
}
function test2($arg) {
$$arg = 1; // Trigger symbol table
$arg = str_shuffle(str_repeat('A', 79));
$vuln = new Vuln();
$vuln->a = $arg;
}
test('x');
test2('x');
?>
--EXPECTF--
array(1) {
[0]=>
array(6) {
["file"]=>
string(%d) "%s"
["line"]=>
int(%d)
["function"]=>
string(10) "__destruct"
["class"]=>
string(4) "Vuln"
["type"]=>
string(2) "->"
["args"]=>
array(0) {
}
}
}
array(1) {
[0]=>
array(6) {
["file"]=>
string(%d) "%s"
["line"]=>
int(%d)
["function"]=>
string(10) "__destruct"
["class"]=>
string(4) "Vuln"
["type"]=>
string(2) "->"
["args"]=>
array(0) {
}
}
}