Skip to content

Commit

Permalink
Merge branch 'issue1474-property-reads'
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Sep 25, 2017
2 parents 52adff7 + 94e4afa commit 9da805c
Show file tree
Hide file tree
Showing 41 changed files with 441 additions and 190 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,7 @@ language: php
php:
- 7.0
- 7.1
- 7.2
- nightly

matrix:
Expand Down
4 changes: 2 additions & 2 deletions config.m4
Expand Up @@ -11,7 +11,7 @@ if test "$PHP_XDEBUG" != "no"; then
if test "$PHP_XDEBUG_FOUND_VERNUM" -lt "70000"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.0.0 and < 7.3.0 (found $PHP_XDEBUG_FOUND_VERSION)])
else
if test "$PHP_XDEBUG_FOUND_VERNUM" -ge "70300"; then
if test "$PHP_XDEBUG_FOUND_VERNUM" -ge "70400"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 7.0.0 and < 7.3.0 (found $PHP_XDEBUG_FOUND_VERSION)])
else
AC_MSG_RESULT([supported ($PHP_XDEBUG_FOUND_VERSION)])
Expand All @@ -30,7 +30,7 @@ if test "$PHP_XDEBUG" != "no"; then

CPPFLAGS=$old_CPPFLAGS

PHP_NEW_EXTENSION(xdebug, xdebug.c xdebug_branch_info.c xdebug_code_coverage.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_monitor.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_trace_textual.c xdebug_trace_computerized.c xdebug_trace_html.c xdebug_var.c xdebug_xml.c usefulstuff.c, $ext_shared,,,,yes)
PHP_NEW_EXTENSION(xdebug, xdebug.c xdebug_branch_info.c xdebug_code_coverage.c xdebug_collection.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_monitor.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_trace_textual.c xdebug_trace_computerized.c xdebug_trace_html.c xdebug_var.c xdebug_xml.c usefulstuff.c, $ext_shared,,,,yes)
PHP_SUBST(XDEBUG_SHARED_LIBADD)
PHP_ADD_MAKEFILE_FRAGMENT
fi
2 changes: 1 addition & 1 deletion config.w32
Expand Up @@ -4,6 +4,6 @@
ARG_WITH("xdebug", "Xdebug support", "no");

if (PHP_XDEBUG == "yes") {
EXTENSION("xdebug", "xdebug.c xdebug_branch_info.c xdebug_code_coverage.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_monitor.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_trace_textual.c xdebug_trace_computerized.c xdebug_trace_html.c xdebug_var.c xdebug_xml.c usefulstuff.c");
EXTENSION("xdebug", "xdebug.c xdebug_branch_info.c xdebug_code_coverage.c xdebug_collection.c xdebug_com.c xdebug_compat.c xdebug_handler_dbgp.c xdebug_handlers.c xdebug_llist.c xdebug_monitor.c xdebug_hash.c xdebug_private.c xdebug_profiler.c xdebug_set.c xdebug_stack.c xdebug_str.c xdebug_superglobals.c xdebug_tracing.c xdebug_trace_textual.c xdebug_trace_computerized.c xdebug_trace_html.c xdebug_var.c xdebug_xml.c usefulstuff.c");
AC_DEFINE("HAVE_XDEBUG", 1, "Xdebug support");
}
2 changes: 2 additions & 0 deletions package.xml
Expand Up @@ -118,6 +118,8 @@ Sun, Dec 4, 2016 - xdebug 2.5.0
<file name="xdebug_branch_info.h" role="src" />
<file name="xdebug_code_coverage.c" role="src" />
<file name="xdebug_code_coverage.h" role="src" />
<file name="xdebug_collection.c" role="src" />
<file name="xdebug_collection.h" role="src" />
<file name="xdebug_com.c" role="src" />
<file name="xdebug_com.h" role="src" />
<file name="xdebug_compat.c" role="src" />
Expand Down
4 changes: 1 addition & 3 deletions tests/array_map.phpt
Expand Up @@ -19,18 +19,16 @@ $tf = xdebug_start_trace(sys_get_temp_dir() . '/' . uniqid('xdt', TRUE));
$ar = array('a', 'bb', 'ccc');
$r = array_map('strlen', $ar);

echo gettype($r), "\n";


echo file_get_contents($tf);
xdebug_stop_trace();
unlink($tf);
?>
--EXPECTF--
array
TRACE START [%d-%d-%d %d:%d:%d]
%w%f %w%d -> array_map('strlen', array (0 => 'a', 1 => 'bb', 2 => 'ccc')) %sarray_map.php:5
%w%f %w%d -> strlen('a') %sarray_map.php:5
%w%f %w%d -> strlen('bb') %sarray_map.php:5
%w%f %w%d -> strlen('ccc') %sarray_map.php:5
%w%f %w%d -> gettype(array (0 => 1, 1 => 2, 2 => 3)) %sarray_map.php:7
%w%f %w%d -> file_get_contents('%s') %sarray_map.php:9
4 changes: 2 additions & 2 deletions tests/assignment-trace2.phpt
Expand Up @@ -59,8 +59,8 @@ TRACE START [%d-%d-%d %d:%d:%d]
%w%f %w%d -> test(1, 2, 3) %sassignment-trace2.php:21
=> $t = array ('a' => 4, 'b' => 9, 'c' => 13) %sassignment-trace2.php:6
=> $t['d'] = 89 %sassignment-trace2.php:7
=> $t['a'] += NULL %sassignment-trace2.php:8
=> $t['a'] += NULL %sassignment-trace2.php:9
=> $t['a'] += %r(NULL|\*uninitialized\*)%r %sassignment-trace2.php:8
=> $t['a'] += %r(NULL|\*uninitialized\*)%r %sassignment-trace2.php:9
=> $t['c'] /= 7 %sassignment-trace2.php:10
=> $t['b'] *= 9 %sassignment-trace2.php:11
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace2.php:23
Expand Down
4 changes: 2 additions & 2 deletions tests/assignment-trace3.phpt
Expand Up @@ -34,8 +34,8 @@ Call Stack:
TRACE START [%d-%d-%d %d:%d:%d]
=> $tf = '%s' %sassignment-trace3.php:2
=> $t = array ('a' => 4, 'b' => 9, 'c' => 13) %sassignment-trace3.php:4
=> $t['a'] += NULL %sassignment-trace3.php:5
=> $t['a'] += NULL %sassignment-trace3.php:6
=> $t['a'] += %r(NULL|\*uninitialized\*)%r %sassignment-trace3.php:5
=> $t['a'] += %r(NULL|\*uninitialized\*)%r %sassignment-trace3.php:6
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace3.php:8
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
4 changes: 2 additions & 2 deletions tests/assignment-trace4.phpt
Expand Up @@ -34,8 +34,8 @@ Call Stack:
TRACE START [%d-%d-%d %d:%d:%d]
=> $tf = '%s' %sassignment-trace4.php:2
=> $t = 42 %sassignment-trace4.php:4
=> $t += NULL %sassignment-trace4.php:5
=> $t += NULL %sassignment-trace4.php:6
=> $t += %r(NULL|\*uninitialized\*)%r %sassignment-trace4.php:5
=> $t += %r(NULL|\*uninitialized\*)%r %sassignment-trace4.php:6
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace4.php:8
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
2 changes: 1 addition & 1 deletion tests/bug00472.inc
Expand Up @@ -4,7 +4,7 @@
* @copyright Elizabeth Smith (c) 2009
*/
namespace Baalat;
abstract class Object {
abstract class pObject {
public function emit($name) {
if (is_null($this->state)) {
$this->state = new \SplObjectStorage();
Expand Down
6 changes: 3 additions & 3 deletions tests/bug00567-php71-zts-opcache.phpt
Expand Up @@ -17,6 +17,6 @@ function func(){

func();
?>
--EXPECT--
a: (refcount=1, is_ref=0)='hoge'
a: (refcount=1, is_ref=0)='hoge'(29)
--EXPECTF--
a: (refcount=%r(1|2)%r, is_ref=0)='hoge'
a: (refcount=%r(1|2)%r, is_ref=0)='hoge'(29)
6 changes: 3 additions & 3 deletions tests/bug00567-php71-zts.phpt
Expand Up @@ -17,6 +17,6 @@ function func(){

func();
?>
--EXPECT--
a: (refcount=2, is_ref=0)='hoge'
a: (refcount=2, is_ref=0)='hoge'(29)
--EXPECTF--
a: (refcount=%r(2|0)%r, is_ref=0)='hoge'
a: (refcount=%r(2|0)%r, is_ref=0)='hoge'(29)
2 changes: 1 addition & 1 deletion tests/bug00643-t1.inc
Expand Up @@ -20,7 +20,7 @@ require_once('bug00643-t2.inc');
function t1()
{
global $a;
if (count($a) && errors_fatal($a))
if (array_count_values($a) && errors_fatal($a))
{
echo "ok";
}
Expand Down
2 changes: 1 addition & 1 deletion tests/bug00643-t2.inc
Expand Up @@ -9,7 +9,7 @@

function errors_fatal($a) {
$ia = 'is_array';
count($a) && $ia($a);
array_count_values($a) && $ia($a);
return FALSE;
}
?>
2 changes: 1 addition & 1 deletion tests/bug00643.phpt
Expand Up @@ -33,7 +33,7 @@ calls=1 0 0
2 %d

fl=(3) php:internal
fn=(3) php::count
fn=(3) php::array_count_values
23 %d

fl=(3)
Expand Down
40 changes: 40 additions & 0 deletions tests/bug00699-php72.phpt
@@ -0,0 +1,40 @@
--TEST--
Test for bug #699: Xdebug gets the filename wrong for the countable interface (>= PHP 7.2)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.2", '>=')) echo "skip >= PHP 7.2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.trace_format=0
xdebug.collect_vars=0
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.collect_assignments=0
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/'. uniqid('xdt', TRUE));

require dirname( __FILE__ ) . '/bug00699.inc';
$n = new SomeClass;
$n->addData('foobar');



count($n);



xdebug_stop_trace();
echo file_get_contents($tf);
unlink($tf);
?>
--EXPECTF--
TRACE START [%d-%d-%d %d:%d:%d]
%w%f %w%d -> dirname(string(%d)) %sbug00699-php72.php:4
%w%f %w%d -> require(%sbug00699.inc) %sbug00699-php72.php:4
%w%f %w%d -> SomeClass->addData(string(6)) %sbug00699-php72.php:6
%w%f %w%d -> SomeClass->count(%S) %sbug00699-php72.php:10
%w%f %w%d -> xdebug_stop_trace() %sbug00699-php72.php:14
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
4 changes: 3 additions & 1 deletion tests/bug00699.phpt
@@ -1,5 +1,7 @@
--TEST--
Test for bug #699: Xdebug gets the filename wrong for the countable interface
Test for bug #699: Xdebug gets the filename wrong for the countable interface (< PHP 7.2)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.2", '<')) echo "skip < PHP 7.2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.profiler_enable=0
Expand Down
66 changes: 0 additions & 66 deletions tests/bug00756-php7-opcache.phpt

This file was deleted.

4 changes: 1 addition & 3 deletions tests/bug00756-php7.phpt
@@ -1,7 +1,5 @@
--TEST--
Test for bug #756: Tracing doesn't always understand the variables and shows IS_VAR
--SKIPIF--
<?php if (extension_loaded('zend opcache')) echo "skip opcache should not be loaded\n"; ?>
--INI--
xdebug.auto_trace=0
xdebug.trace_options=0
Expand Down Expand Up @@ -52,7 +50,7 @@ TRACE START [%d-%d-%d %d:%d:%d]
%w%f %w%d >=> '%sxdt%s.%s.xt'
=> $trace_file = '%sxdt%s.%s.xt' %sbug00756-php7.php:19
%w%f %w%d -> foo::bar() %sbug00756-php7.php:21
=> self::bar++ %sbug00756-php7.php:9
=> %r(\+\+self::bar|self::bar\+\+)%r %sbug00756-php7.php:9
%w%f %w%d -> foo->__construct() %sbug00756-php7.php:22
=> $this->foo++ %sbug00756-php7.php:14
=> $f = class foo { public $foo = 1 } %sbug00756-php7.php:22
Expand Down
4 changes: 2 additions & 2 deletions tests/bug00811.phpt
Expand Up @@ -13,7 +13,7 @@ xdebug.show_error_trace=0
date_create("hocuspocus", "fasdfasdf", "afsdfasdf");

// static method
DateTime::createFromFormat("fasdfdsaf", "fasdf", "fasdf");
DateTime::createFromFormat("fasdfdsaf", "fasdf", NULL, "fasdf");

// ctor
new ArrayObject("fasdfdsaf", "fasdf", "fasdf");
Expand All @@ -30,7 +30,7 @@ new ArrayObject("fasdfdsaf", "fasdf", "fasdf");
</table></font>
<br />
<font size='1'><table class='xdebug-error xe-warning' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Warning: DateTime::createFromFormat() expects parameter 3 to be DateTimeZone, string given in %sbug00811.php on line <i>6</i></th></tr>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Warning: DateTime::createFromFormat() expects at most 3 parameters, 4 given in %sbug00811.php on line <i>6</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>%f</td><td bgcolor='#eeeeec' align='right'>%d</td><td bgcolor='#eeeeec'>{main}( )</td><td title='%sbug00811.php' bgcolor='#eeeeec'>...%sbug00811.php<b>:</b>0</td></tr>
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions tests/bug00978-2.phpt
@@ -0,0 +1,17 @@
--TEST--
Test for bug #978: Inspection of array with negative keys fails
--FILE--
<?php
include dirname(__FILE__) . '/bug00978.inc';

xdebug_debug_zval('$a');
xdebug_debug_zval('$a[-1]');
xdebug_debug_zval('$a[-]');
xdebug_debug_zval('$a[1]');
?>
--EXPECTF--
4
$a: (refcount=%d, is_ref=0)=array (0 => (refcount=1, is_ref=0)='nul', -1 => (refcount=1, is_ref=0)='minus one', -2 => (refcount=1, is_ref=0)='not two', 1 => (refcount=1, is_ref=0)='een')
$a[-1]: (refcount=1, is_ref=0)='minus one'
$a[-]: no such symbol
$a[1]: (refcount=1, is_ref=0)='een'
File renamed without changes.
12 changes: 12 additions & 0 deletions tests/bug01048-2.phpt
@@ -0,0 +1,12 @@
--TEST--
Test for bug #1048: Can not get $GLOBAL variable by property_value on function context
--FILE--
<?php
include dirname(__FILE__) . '/bug01048.inc';

xdebug_debug_zval('$GLOBALS[\'cache\']');
xdebug_debug_zval('$GLOBALS[\'cache\']');
?>
--EXPECTF--
11$GLOBALS['cache']: (refcount=%d, is_ref=0)='cache'
$GLOBALS['cache']: (refcount=%d, is_ref=0)='cache'
2 changes: 1 addition & 1 deletion tests/bug01130.phpt
Expand Up @@ -9,7 +9,7 @@ xdebug.file_link_format=
xdebug.collect_params=0
--FILE--
<?php
html_entity_decode("", 0, "l<r");
html_entity_decode("&amp;", 0, "l<r");
?>
--EXPECTF--
<br />
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions tests/bug01272-2.phpt
@@ -0,0 +1,20 @@
--TEST--
Test for bug #1272: property_get doesn't return attributes for SimpleXMLElement
--FILE--
<?php
include dirname(__FILE__) . '/bug01272.inc';

xdebug_debug_zval('e');
xdebug_debug_zval('e->@attributes');
xdebug_debug_zval('e->@attributes["att1"]');
xdebug_debug_zval('e->b[0]->@attributes');
xdebug_debug_zval('e->b[1]->@attributes["attb"]');
?>
--EXPECTF--
attb-1
attb-2
e: (refcount=1, is_ref=0)=class SimpleXMLElement { public $@attributes = (refcount=1, is_ref=0)=array ('att1' => (refcount=1, is_ref=0)='att-a'); public $b = (refcount=1, is_ref=0)=array (0 => (refcount=1, is_ref=0)=class SimpleXMLElement { ... }, 1 => (refcount=1, is_ref=0)=class SimpleXMLElement { ... }) }
e->@attributes: (refcount=1, is_ref=0)=array ('att1' => (refcount=1, is_ref=0)='att-a')
e->@attributes["att1"]: (refcount=1, is_ref=0)='att-a'
e->b[0]->@attributes: (refcount=1, is_ref=0)=array ('attb' => (refcount=1, is_ref=0)='attb-1')
e->b[1]->@attributes["attb"]: (refcount=1, is_ref=0)='attb-2'
4 changes: 2 additions & 2 deletions tests/trace_with_magic_call_method.phpt
Expand Up @@ -19,7 +19,7 @@ class Test {
return $this->$func($args);
}
private function testFunc($args) {
count($args);
array_sum($args);
}
}

Expand All @@ -36,7 +36,7 @@ TRACE START [%d-%d-%d %d:%d:%d]
%w%f %w%d -> Test->testFunc(string(5), string(5)) %strace_with_magic_call_method.php:15
%w%f %w%d -> Test->__call(string(8), array(2)) %strace_with_magic_call_method.php:15
%w%f %w%d -> Test->testFunc(array(2)) %strace_with_magic_call_method.php:7
%w%f %w%d -> count(array(2)) %strace_with_magic_call_method.php:10
%w%f %w%d -> array_sum(array(2)) %strace_with_magic_call_method.php:10
%w%f %w%d -> xdebug_stop_trace() %strace_with_magic_call_method.php:17
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
6 changes: 3 additions & 3 deletions tests/xdebug_debug_zval-php71-zts-opcache.phpt
Expand Up @@ -35,9 +35,9 @@ function func(){

func();
?>
--EXPECT--
a: (refcount=1, is_ref=0)='hoge'
$a: (refcount=1, is_ref=0)='hoge'
--EXPECTF--
a: (refcount=%r(0|1|2)%r, is_ref=0)='hoge'
$a: (refcount=%r(0|1|2)%r, is_ref=0)='hoge'
$b: (refcount=1, is_ref=0)=array ('a' => (refcount=0, is_ref=0)=4, 'b' => (refcount=2, is_ref=1)=5, 'c' => (refcount=0, is_ref=0)=6, 0 => (refcount=0, is_ref=0)=8, 1 => (refcount=0, is_ref=0)=9)
$b['a']: (refcount=0, is_ref=0)=4
$b['b']: (refcount=2, is_ref=1)=5
Expand Down

0 comments on commit 9da805c

Please sign in to comment.