Permalink
Browse files

Merged pull request #447

  • Loading branch information...
derickr committed Feb 9, 2019
2 parents 28660ac + 5233246 commit 01af9ba069e4fb930195b4f46a16e32fd831193a
@@ -1,8 +1,8 @@
--TEST--
Test for tracing array assignments in user-readable function traces (>= PHP 7.3, opcache)
Test for tracing array assignments in user-readable function traces (>= PHP 7.3.2, opcache)
--SKIPIF--
<?php
if ( ! ( version_compare(phpversion(), "7.3", '>=') && extension_loaded('zend opcache'))) { echo "skip >= PHP 7.3 && opcache loaded needed\n"; };
if ( ! ( version_compare(phpversion(), "7.3.2", '>=') && extension_loaded('zend opcache'))) { echo "skip >= PHP 7.3.2 && opcache loaded needed\n"; };
?>
--INI--
xdebug.default_enable=1
@@ -64,6 +64,8 @@ TRACE START [%d-%d-%d %d:%d:%d]
=> $t = array ('a' => 4, 'b' => 9, 'c' => 13, 'd' => 89) %sassignment-trace2-php73-opcache.php:7
=> $t['a'] += %r(NULL|\*uninitialized\*)%r %sassignment-trace2-php73-opcache.php:8
=> $t['a'] += %r(NULL|\*uninitialized\*)%r %sassignment-trace2-php73-opcache.php:9
=> $t['c'] /= 7 %sassignment-trace2-php73-opcache.php:10
=> $t['b'] *= 9 %sassignment-trace2-php73-opcache.php:11
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace2-php73-opcache.php:23
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
@@ -13,7 +13,7 @@ xdebug.trace_format=0
date.timezone=Europe/Oslo
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/bug00003.trace');
$tf = xdebug_start_trace(sys_get_temp_dir() . '/bug00003-' . uniqid() . '.trace');
strftime('%b %l %Y %H:%M:%S', 1061728888);
xdebug_stop_trace();
readfile($tf);
@@ -2,22 +2,23 @@
Test for bug #314: PHP CLI Error logging thwarted when Xdebug loaded
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") { exit("skip Not for Windows"); } ?>
<?php if (getenv("SKIP_UNPARALLEL_TESTS")) { exit("skip Excluding tests that can not be run in parallel"); } ?>
--INI--
xdebug.default_enable=1
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.profiler_enable=0
xdebug.trace_format=0
log_errors=1
error_log=/tmp/bug315.log
error_log=/tmp/bug314.log
xdebug.collect_params=3
date.timezone=UTC
--FILE--
<?php
@unlink("/tmp/bug315.log");
@unlink("/tmp/bug314.log");
trigger_error('Error', E_USER_WARNING);
echo "FROM LOG\n";
echo file_get_contents("/tmp/bug315.log");
echo file_get_contents("/tmp/bug314.log");
?>
--EXPECTF--
Warning: Error in %sbug00314.php on line 3
@@ -1,5 +1,7 @@
--TEST--
Test for bug #690: Function traces are not appended to file when xdebug_start_trace() is used with xdebug.trace_options=1 (step 1 of 2)
--SKIPIF--
<?php if (getenv("SKIP_UNPARALLEL_TESTS")) { exit("skip Excluding tests that can not be run in parallel"); } ?>
--INI--
xdebug.trace_output_name=trace.bug690
xdebug.trace_options=1
@@ -1,5 +1,7 @@
--TEST--
Test for bug #690: Function traces are not appended to file when xdebug_start_trace() is used with xdebug.trace_options=1 (step 2 of 2)
--SKIPIF--
<?php if (getenv("SKIP_UNPARALLEL_TESTS")) { exit("skip Excluding tests that can not be run in parallel"); } ?>
--INI--
xdebug.auto_trace=0
xdebug.trace_output_name=trace.bug690
@@ -2,6 +2,7 @@
Test for bug #932: Show an error if Xdebug can't open the remote debug log.
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
<?php if (getenv("SKIP_DBGP_TESTS")) { exit("skip Excluding DBGp tests"); } ?>
--INI--
xdebug.default_enable=1
xdebug.remote_enable=1
@@ -2,6 +2,7 @@
Test for bug #964: IP retrival from X-Forwarded-For complies with RFC 7239 (without comma)
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
<?php if (getenv("SKIP_UNPARALLEL_TESTS")) { exit("skip Excluding tests that can not be run in parallel"); } ?>
--ENV--
HTTP_X_FORWARDED_FOR=192.168.111.111
--INI--
@@ -2,6 +2,7 @@
Test for bug #964: IP retrival from X-Forwarded-For complies with RFC 7239 (with comma)
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
<?php if (getenv("SKIP_UNPARALLEL_TESTS")) { exit("skip Excluding tests that can not be run in parallel"); } ?>
--ENV--
HTTP_X_FORWARDED_FOR=192.168.111.111, 10.1.2.3, 10.1.2.4
--INI--
@@ -2,6 +2,7 @@
Test for Xdebug's remote log (with unix sockets and header)
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
<?php if (getenv("SKIP_DBGP_TESTS")) { exit("skip Excluding DBGp tests"); } ?>
--ENV--
I_LIKE_COOKIES=unix:///tmp/haxx0r.sock
--INI--
@@ -2,6 +2,7 @@
Test for Xdebug's remote log (with unix sockets)
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
<?php if (getenv("SKIP_DBGP_TESTS")) { exit("skip Excluding DBGp tests"); } ?>
--ENV--
I_LIKE_COOKIES=doesnotexist3
--INI--
@@ -2,6 +2,7 @@
Test for Xdebug's remote log (can not connect, no remote callback)
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
<?php if (getenv("SKIP_DBGP_TESTS")) { exit("skip Excluding DBGp tests"); } ?>
--INI--
xdebug.remote_enable=1
xdebug.remote_log=/tmp/remote-log1.txt
@@ -2,6 +2,7 @@
Test for Xdebug's remote log (can not connect, with not-found remote callback)
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
<?php if (getenv("SKIP_DBGP_TESTS")) { exit("skip Excluding DBGp tests"); } ?>
--INI--
xdebug.remote_enable=1
xdebug.remote_log=/tmp/remote-log2.txt
@@ -2,6 +2,7 @@
Test for Xdebug's remote log (with xdebug.remote_addr_header)
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
<?php if (getenv("SKIP_DBGP_TESTS")) { exit("skip Excluding DBGp tests"); } ?>
--INI--
xdebug.remote_enable=1
xdebug.remote_log=/tmp/remote-log3.txt
@@ -2,6 +2,7 @@
Test for Xdebug's remote log (with xdebug.remote_addr_header value)
--SKIPIF--
<?php if (substr(PHP_OS, 0, 3) == "WIN") die("skip Not for Windows"); ?>
<?php if (getenv("SKIP_DBGP_TESTS")) { exit("skip Excluding DBGp tests"); } ?>
--ENV--
I_LIKE_COOKIES=doesnotexist3
--INI--
@@ -12,16 +12,16 @@ xdebug.show_mem_delta=0
xdebug.trace_format=0
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/bug971', XDEBUG_TRACE_COMPUTERIZED);
$tf = xdebug_start_trace(sys_get_temp_dir() . '/bug971' . uniqid(), XDEBUG_TRACE_COMPUTERIZED);
echo $tf, "\n";
xdebug_stop_trace();
unlink($tf);
$tf = xdebug_start_trace(sys_get_temp_dir() . '/bug971', XDEBUG_TRACE_COMPUTERIZED | XDEBUG_TRACE_NAKED_FILENAME);
$tf = xdebug_start_trace(sys_get_temp_dir() . '/bug971' . uniqid(), XDEBUG_TRACE_COMPUTERIZED | XDEBUG_TRACE_NAKED_FILENAME);
echo $tf, "\n";
xdebug_stop_trace();
unlink($tf);
?>
--EXPECTF--
%sbug971.xt
%sbug971
%sbug971%s.xt
%sbug971%s
@@ -1078,12 +1078,8 @@ static void function_stack_entry_dtor(void *dummy, void *elem)
e->refcount--;

if (e->refcount == 0) {
if (e->function.function) {
xdfree(e->function.function);
}
if (e->function.class) {
xdfree(e->function.class);
}
xdebug_func_dtor_by_ref(&e->function);

if (e->filename) {
xdfree(e->filename);
}
@@ -88,6 +88,7 @@ int xdebug_gc_collect_cycles(void)
xdebug_gc_stats_print_run(run);

xdebug_gc_stats_run_free(run);
xdebug_func_dtor_by_ref(&tmp);

return ret;
}
@@ -986,6 +986,24 @@ char* xdebug_wrap_closure_location_around_function_name(zend_op_array *opa, char
return tmp.d;
}

/* I don't like this API, but the function_stack_entry does not keep this as a
* pointer, and hence we need two APIs for freeing :-S */
void xdebug_func_dtor_by_ref(xdebug_func *elem)
{
if (elem->function) {
xdfree(elem->function);
}
if (elem->class) {
xdfree(elem->class);
}
}

void xdebug_func_dtor(xdebug_func *elem)
{
xdebug_func_dtor_by_ref(elem);
xdfree(elem);
}

void xdebug_build_fname(xdebug_func *tmp, zend_execute_data *edata TSRMLS_DC)
{
memset(tmp, 0, sizeof(xdebug_func));
@@ -25,6 +25,8 @@

int xdebug_function_name_is_closure(char *fname);
char* xdebug_wrap_closure_location_around_function_name(zend_op_array *opa, char *fname);
void xdebug_func_dtor_by_ref(xdebug_func *elem); /* TODO: Remove this API */
void xdebug_func_dtor(xdebug_func *elem);
void xdebug_build_fname(xdebug_func *tmp, zend_execute_data *edata TSRMLS_DC);
function_stack_entry *xdebug_add_stack_frame(zend_execute_data *zdata, zend_op_array *op_array, int type TSRMLS_DC);
void xdebug_append_error_head(xdebug_str *str, int html, const char *error_type_str TSRMLS_DC);

0 comments on commit 01af9ba

Please sign in to comment.