Skip to content

Commit

Permalink
- PHP 4.4 compatibility.
Browse files Browse the repository at this point in the history
- Fixed/added test cases for PHP 4.4.

SVN Rev: 2217
  • Loading branch information
derickr committed Dec 23, 2006
1 parent da25e35 commit ebd77e0
Show file tree
Hide file tree
Showing 33 changed files with 396 additions and 18 deletions.
2 changes: 1 addition & 1 deletion test-4.3.sh
@@ -1 +1 @@
TEST_PHP_EXECUTABLE=`which php-4.3dev` php-4.3dev /dat/dev/php/php-4.3dev/run-tests.php tests/*.phpt
TEST_PHP_EXECUTABLE=`which php-4.4dev` php-5.2dev /dat/dev/php/php-5.2dev/run-tests.php tests/*.phpt
1 change: 1 addition & 0 deletions test-5.1.sh
@@ -0,0 +1 @@
TEST_PHP_EXECUTABLE=`which php-5.1dev` php-5.1dev -dxdebug.auto_trace=0 /dat/dev/php/php-5.1dev/run-tests.php tests/*.phpt
1 change: 1 addition & 0 deletions test-5.2.sh
@@ -0,0 +1 @@
TEST_PHP_EXECUTABLE=`which php-5.2dev` php-5.2dev -dxdebug.auto_trace=0 /dat/dev/php/php-5.2dev/run-tests.php tests/*.phpt
6 changes: 3 additions & 3 deletions tests/array_map.phpt
Expand Up @@ -29,8 +29,8 @@ unlink($tf);
array
TRACE START [%d-%d-%d %d:%d:%d]
%w%f %w%d -> array_map('strlen', array (0 => 'a', 1 => 'bb', 2 => 'ccc')) /%s/array_map.php:5
%w%f %w%d -> strlen('a') /%s/array_map.php:5
%w%f %w%d -> strlen('bb') /%s/array_map.php:5
%w%f %w%d -> strlen('ccc') /%s/array_map.php:5
%w%f %w%d -> strlen('a') /%s/array_map.php:0
%w%f %w%d -> strlen('bb') /%s/array_map.php:0
%w%f %w%d -> strlen('ccc') /%s/array_map.php:0
%w%f %w%d -> gettype(array (0 => 1, 1 => 2, 2 => 3)) /%s/array_map.php:7
%w%f %w%d -> file_get_contents('/tmp/%s') /%s/array_map.php:9
48 changes: 48 additions & 0 deletions tests/bug00022-ze1.phpt
@@ -0,0 +1,48 @@
--TEST--
Test for segmentation fault with xdebug_get_function_stack() and collect_params=1. (ZE1)
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '>')) echo "skip Zend Engine 1 needed\n"; ?>
--INI--
xdebug.enable=1
xdebug.auto_trace=0
xdebug.collect_params=1
xdebug.profiler_enable=0
--FILE--
<?php
function foo($s) {
print $s;
var_dump(xdebug_get_function_stack());
}

foo('bar');
?>
--EXPECTF--
bararray(2) {
[0]=>
array(4) {
["function"]=>
string(6) "{main}"
["file"]=>
string(%d) "/%s/bug00022-ze1.php"
["line"]=>
int(0)
["params"]=>
array(0) {
}
}
[1]=>
array(4) {
["function"]=>
string(3) "foo"
["file"]=>
string(%d) "/%s/bug00022-ze1.php"
["line"]=>
int(7)
["params"]=>
array(1) {
[0]=>
string(5) "'bar'"
}
}
}
3 changes: 2 additions & 1 deletion tests/bug00022.phpt
@@ -1,7 +1,8 @@
--TEST--
Test for segmentation fault with xdebug_get_function_stack() and collect_params=1.
Test for segmentation fault with xdebug_get_function_stack() and collect_params=1. (ZE20)
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2.0 needed\n"; ?>
--INI--
xdebug.enable=1
xdebug.auto_trace=0
Expand Down
5 changes: 5 additions & 0 deletions tests/bug00032-ze1.phpt
Expand Up @@ -9,6 +9,7 @@ xdebug.auto_trace=0
xdebug.collect_params=1
xdebug.profiler_enable=0
xdebug.show_local_vars=0
xdebug.dump_globals=0
--FILE--
<?php
${1} = "foo";
Expand All @@ -32,19 +33,23 @@ Notice: Array to string conversion in %sbug00032-ze1.php on line 8
Call Stack:
%f %d 1. {main}() %sbug00032-ze1.php:0


Notice: Array to string conversion in %sbug00032-ze1.php on line 9

Call Stack:
%f %d 1. {main}() %sbug00032-ze1.php:0

foo

Notice: Object to string conversion in %sbug00032-ze1.php on line 11

Call Stack:
%f %d 1. {main}() %sbug00032-ze1.php:0


Notice: Object to string conversion in %sbug00032-ze1.php on line 12

Call Stack:
%f %d 1. {main}() %sbug00032-ze1.php:0

foo
5 changes: 4 additions & 1 deletion tests/bug00057-ze1.phpt
Expand Up @@ -11,6 +11,7 @@ xdebug.collect_return=0
xdebug.show_mem_delta=0
xdebug.profiler_enable=0
xdebug.show_local_vars=0
xdebug.dump_globals=0
--FILE--
<?php
class OO {
Expand All @@ -37,12 +38,14 @@ Notice: Undefined offset: 0 in /%s/bug00057-ze1.php on line 9

Call Stack:
%f %d 1. {main}() /%s/bug00057-ze1.php:0
%f %d 2. oo->__call('oo', array (), NULL) /%s/bug00057-ze1.php:16
%f %d 2. oo->__call(string(2), array(0), null) /%s/bug00057-ze1.php:0

0
Warning: Call to undefined method oo::oo() in /%s/bug00057-ze1.php on line 16

Call Stack:
%f %d 1. {main}() /%s/bug00057-ze1.php:0

2
Warning: Call to undefined method oo::foo() in /%s/bug00057-ze1.php on line 18

Expand Down
3 changes: 3 additions & 0 deletions tests/bug00173.phpt
@@ -1,5 +1,8 @@
--TEST--
Test for bug #173: Xdebug segfaults using SPL ArrayIterator.
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.2.0-dev", '<')) echo "skip Zend Engine 2.2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=1
Expand Down
3 changes: 3 additions & 0 deletions tests/bug00176.phpt
@@ -1,5 +1,8 @@
--TEST--
Test for bug #176: Segfault using SplTempFileObject
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.2.0-dev", '<')) echo "skip Zend Engine 2.2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
Expand Down
4 changes: 2 additions & 2 deletions tests/bug00178.phpt
Expand Up @@ -22,7 +22,7 @@ fsockopen( 'localhost', 5000, $errno, $errstr, 0.02 );
echo "> ", $php_errormsg, "\n";
?>
DONE
--EXPECT--
--EXPECTF--
> fsockopen() expects at least 1 parameter, 0 given
> fsockopen(): unable to connect to localhost:5000 (Connection refused)
> %snable to connect to localhost:500%s
DONE
40 changes: 40 additions & 0 deletions tests/bug00212a-ze1.phpt
@@ -0,0 +1,40 @@
--TEST--
Test for bug #212: coverage coverage inaccurate (ZE1).
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '>')) echo "skip Zend Engine 1 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.extended_info=1
--FILE--
<?php
xdebug_start_code_coverage( XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE );
$file = realpath('./tests/bug00212a.inc');
include $file;
$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc[$file]);
?>
--EXPECT--
array(5) {
[5]=>
int(1)
[7]=>
int(1)
[9]=>
int(1)
[10]=>
int(-1)
[12]=>
int(1)
}
3 changes: 2 additions & 1 deletion tests/bug00212a.phpt
@@ -1,7 +1,8 @@
--TEST--
Test for bug #212: coverage coverage inaccurate.
Test for bug #212: coverage coverage inaccurate (ZE2).
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
Expand Down
1 change: 1 addition & 0 deletions tests/bug00212b.phpt
Expand Up @@ -2,6 +2,7 @@
Test for bug #212: coverage coverage inaccurate.
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
Expand Down
1 change: 1 addition & 0 deletions tests/bug00212c.phpt
Expand Up @@ -2,6 +2,7 @@
Test for bug #212: coverage coverage inaccurate.
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
Expand Down
1 change: 1 addition & 0 deletions tests/bug00213.phpt
Expand Up @@ -2,6 +2,7 @@
Test for bug #213: Dead code analysis doesn't take catches for throws into account.
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
Expand Down
56 changes: 56 additions & 0 deletions tests/coverage-ze1.phpt
@@ -0,0 +1,56 @@
--TEST--
Test with Code Coverage (ZE1)
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '>')) echo "skip Zend Engine 1 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.extended_info=1
--FILE--
<?php
xdebug_start_code_coverage();
$file = realpath('./tests/coverage.inc');
include $file;
$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc[$file]);
?>
--EXPECTF--
This is a YYYY-MM-DD format.
This is a YYYYMMDD HHii format.
array(12) {
[2]=>
int(1)
[4]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[10]=>
int(1)
[11]=>
int(1)
[17]=>
int(1)
[18]=>
int(1)
[20]=>
int(1)
[21]=>
int(1)
[22]=>
int(1)
[25]=>
int(1)
}
3 changes: 2 additions & 1 deletion tests/coverage.phpt
@@ -1,7 +1,8 @@
--TEST--
Test with Code Coverage
Test with Code Coverage (ZE2)
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
Expand Down
68 changes: 68 additions & 0 deletions tests/coverage2-ze1.phpt
@@ -0,0 +1,68 @@
--TEST--
Test with Code Coverage with unused lines (ZE1)
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '>')) echo "skip Zend Engine 1 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.trace_options=0
xdebug.trace_output_dir=/tmp
xdebug.collect_params=1
xdebug.collect_return=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.dump_globals=0
xdebug.show_mem_delta=0
xdebug.trace_format=0
xdebug.extended_info=1
--FILE--
<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
$file = realpath('./tests/coverage.inc');
include $file;
$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc[$file]);
?>
--EXPECTF--
This is a YYYY-MM-DD format.
This is a YYYYMMDD HHii format.
array(%d) {
[2]=>
int(1)
[4]=>
int(1)
[5]=>
int(-1)
[6]=>
int(-1)
[7]=>
int(1)
[8]=>
int(1)
[9]=>
int(-1)
[10]=>
int(1)
[11]=>
int(1)
[12]=>
int(-1)
[14]=>
int(-1)
[17]=>
int(1)
[18]=>
int(1)
[20]=>
int(1)
[21]=>
int(1)
[22]=>
int(1)
[23]=>
int(-1)
[25]=>
int(1)
}
3 changes: 2 additions & 1 deletion tests/coverage2.phpt
@@ -1,7 +1,8 @@
--TEST--
Test with Code Coverage with unused lines
Test with Code Coverage with unused lines (ZE2)
--SKIPIF--
<?php if (!extension_loaded("xdebug")) print "skip"; ?>
<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
Expand Down

0 comments on commit ebd77e0

Please sign in to comment.