Skip to content
Closed
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 Zend/tests/bug50383.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Array

)

[strict_types] => 0
)

[1] => Array
Expand All @@ -66,6 +67,7 @@ Array
(
)

[strict_types] => 0
)

)
Expand All @@ -88,6 +90,7 @@ Array

)

[strict_types] => 0
)

[1] => Array
Expand All @@ -99,6 +102,7 @@ Array
(
)

[strict_types] => 0
)

)
2 changes: 2 additions & 0 deletions Zend/tests/bug64239_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Array
[function] => Bmethod
[class] => B
[type] => ->
[strict_types] => 0
)

)
Expand All @@ -53,6 +54,7 @@ Array
[function] => Bmethod
[class] => B
[type] => ->
[strict_types] => 0
)

)
4 changes: 3 additions & 1 deletion Zend/tests/bug73156.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ array(2) {
string(4) "eval"
}
[1]=>
array(7) {
array(8) {
["file"]=>
string(%d) "%sbug73156.php"
["line"]=>
Expand All @@ -46,5 +46,7 @@ array(2) {
array(0) {
}
}
["strict_types"]=>
int(0)
}
}
3 changes: 3 additions & 0 deletions Zend/tests/closure_032.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Array
[0] => 23
)

[strict_types] => 0
)

)
Expand All @@ -42,6 +43,7 @@ Array
[0] => 23
)

[strict_types] => 0
)

[1] => Array
Expand All @@ -62,6 +64,7 @@ Array

)

[strict_types] => 0
)

)
Expand Down
9 changes: 9 additions & 0 deletions Zend/tests/debug_backtrace_limit.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Array
(
)

[strict_types] => 0
)

)
Expand All @@ -45,6 +46,7 @@ Array
(
)

[strict_types] => 0
)

[1] => Array
Expand All @@ -56,6 +58,7 @@ Array
(
)

[strict_types] => 0
)

)
Expand All @@ -70,6 +73,7 @@ Array
(
)

[strict_types] => 0
)

[1] => Array
Expand All @@ -81,6 +85,7 @@ Array
(
)

[strict_types] => 0
)

[2] => Array
Expand All @@ -92,6 +97,7 @@ Array
(
)

[strict_types] => 0
)

)
Expand All @@ -106,6 +112,7 @@ Array
(
)

[strict_types] => 0
)

[1] => Array
Expand All @@ -117,6 +124,7 @@ Array
(
)

[strict_types] => 0
)

[2] => Array
Expand All @@ -128,6 +136,7 @@ Array
(
)

[strict_types] => 0
)

)
24 changes: 24 additions & 0 deletions Zend/tests/debug_backtrace_options.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Array
(
)

[strict_types] => 0
)

[1] => Array
Expand All @@ -94,6 +95,7 @@ Array
[2] => backtrace_print
)

[strict_types] => 0
)

[2] => Array
Expand All @@ -113,6 +115,7 @@ Array
[1] => backtrace_print
)

[strict_types] => 0
)

[3] => Array
Expand All @@ -128,6 +131,7 @@ Array
[1] => backtrace_print
)

[strict_types] => 0
)

)
Expand All @@ -144,6 +148,7 @@ Array
[0] => 1
)

[strict_types] => 0
)

[1] => Array
Expand All @@ -158,6 +163,7 @@ Array
[2] => backtrace_print
)

[strict_types] => 0
)

[2] => Array
Expand All @@ -177,6 +183,7 @@ Array
[1] => backtrace_print
)

[strict_types] => 0
)

[3] => Array
Expand All @@ -192,6 +199,7 @@ Array
[1] => backtrace_print
)

[strict_types] => 0
)

)
Expand All @@ -208,6 +216,7 @@ Array
[0] =>
)

[strict_types] => 0
)

[1] => Array
Expand All @@ -222,6 +231,7 @@ Array
[2] => backtrace_print
)

[strict_types] => 0
)

[2] => Array
Expand All @@ -237,6 +247,7 @@ Array
[1] => backtrace_print
)

[strict_types] => 0
)

[3] => Array
Expand All @@ -252,6 +263,7 @@ Array
[1] => backtrace_print
)

[strict_types] => 0
)

)
Expand All @@ -268,6 +280,7 @@ Array
[0] => 1
)

[strict_types] => 0
)

[1] => Array
Expand All @@ -282,6 +295,7 @@ Array
[2] => backtrace_print
)

[strict_types] => 0
)

[2] => Array
Expand All @@ -301,6 +315,7 @@ Array
[1] => backtrace_print
)

[strict_types] => 0
)

[3] => Array
Expand All @@ -316,6 +331,7 @@ Array
[1] => backtrace_print
)

[strict_types] => 0
)

)
Expand All @@ -327,13 +343,15 @@ Array
[file] => %sdebug_backtrace_options.php
[line] => 23
[function] => backtrace_print
[strict_types] => 0
)

[1] => Array
(
[file] => %sdebug_backtrace_options.php
[line] => %d
[function] => doit
[strict_types] => 0
)

[2] => Array
Expand All @@ -343,6 +361,7 @@ Array
[function] => doCall
[class] => foo
[type] => ->
[strict_types] => 0
)

[3] => Array
Expand All @@ -352,6 +371,7 @@ Array
[function] => statCall
[class] => foo
[type] => ::
[strict_types] => 0
)

)
Expand All @@ -363,13 +383,15 @@ Array
[file] => %sdebug_backtrace_options.php
[line] => 25
[function] => backtrace_print
[strict_types] => 0
)

[1] => Array
(
[file] => %sdebug_backtrace_options.php
[line] => %d
[function] => doit
[strict_types] => 0
)

[2] => Array
Expand All @@ -383,6 +405,7 @@ Array
)

[type] => ->
[strict_types] => 0
)

[3] => Array
Expand All @@ -392,6 +415,7 @@ Array
[function] => statCall
[class] => foo
[type] => ::
[strict_types] => 0
)

)
25 changes: 25 additions & 0 deletions Zend/tests/strict_types_debug_backtrace.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
Strict types reported in debug backtrace
--FILE--
<?php declare(strict_types=0);

require 'strict_types_debug_backtrace_helper.inc';

function test_strict_types_debug_backtrace1()
{
return debug_backtrace();
}

$bt1 = test_strict_types_debug_backtrace1();
$bt2 = test_strict_types_debug_backtrace2();

var_dump($bt1[0]['strict_types']);
var_dump($bt2[0]['strict_types'], $bt2[1]['strict_types']);

echo "Done\n";
?>
--EXPECTF--
int(0)
int(0)
int(1)
Done
8 changes: 8 additions & 0 deletions Zend/tests/strict_types_debug_backtrace_helper.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php declare(strict_types=1);

// Separate file with strict_types enabled

function test_strict_types_debug_backtrace2()
{
return test_strict_types_debug_backtrace1();
}
3 changes: 3 additions & 0 deletions Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2711,6 +2711,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
debug_backtrace_get_args(call, &tmp);
zend_hash_add_new(Z_ARRVAL(stack_frame), CG(known_strings)[ZEND_STR_ARGS], &tmp);
}

ZVAL_LONG(&tmp, (func->common.fn_flags & ZEND_ACC_STRICT_TYPES) == ZEND_ACC_STRICT_TYPES);
zend_hash_add_new(Z_ARRVAL(stack_frame), CG(known_strings)[ZEND_STR_STRICT_TYPES], &tmp);
} else {
/* i know this is kinda ugly, but i'm trying to avoid extra cycles in the main execution loop */
zend_bool build_filename_arg = 1;
Expand Down
Loading