import zend tests

This is a first pass looking for suggestions.

    348 / 1268 passed (27.44%)

I modified the script, then ran:

    ./tools/import_zend_test.py /tmp/php-5.4.11/

which created all the zend tests. When they send out a new update, this script is idempotent so running it on the new tests should just make the working directory in a good enough state to commit.
Esse commit está contido em:
ptarjan
2013-03-29 21:09:22 -07:00
commit de Sara Golemon
commit be704f1faf
2543 arquivos alterados com 36651 adições e 14 exclusões
+34
Ver Arquivo
@@ -0,0 +1,34 @@
<?php
function test1() {
var_dump(func_num_args());
}
function test2($a) {
var_dump(func_num_args());
}
function test3($a, $b) {
var_dump(func_num_args());
}
test1();
test2(1);
test2();
test3(1,2);
call_user_func("test1");
call_user_func("test3", 1);
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_num_args());
}
}
test::test1(1);
var_dump(func_num_args());
echo "Done\n";
?>
+16
Ver Arquivo
@@ -0,0 +1,16 @@
int(0)
int(1)
HipHop Warning: Missing argument 1 for test2(), called in hphp/test/zend/bad/001.php on line %d
int(0)
int(2)
int(0)
HipHop Warning: Missing argument 2 for test3() in hphp/test/zend/bad/001.php on line %d
int(1)
int(2)
int(1)
HipHop Warning: func_num_args(): Called from the global scope - no function context in hphp/test/zend/bad/001.php on line %d
int(-1)
Done
+41
Ver Arquivo
@@ -0,0 +1,41 @@
<?php
function test1() {
var_dump(func_get_arg(-10));
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
function test2($a) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
function test3($a, $b) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
var_dump(func_get_arg(2));
}
test1();
test1(10);
test2(1);
test2();
test3(1,2);
call_user_func("test1");
call_user_func("test3", 1);
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
}
test::test1(1);
var_dump(func_get_arg(1));
echo "Done\n";
?>
+63
Ver Arquivo
@@ -0,0 +1,63 @@
HipHop Warning: func_get_arg(): The argument number should be >= 0 in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: func_get_arg(): Argument 0 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: func_get_arg(): Argument 1 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: func_get_arg(): The argument number should be >= 0 in hphp/test/zend/bad/002.php on line %d
bool(false)
int(10)
HipHop Warning: func_get_arg(): Argument 1 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
int(1)
HipHop Warning: func_get_arg(): Argument 1 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: Missing argument 1 for test2(), called in hphp/test/zend/bad/002.php on line %d and defined in hphp/test/zend/bad/002.php on line %d
HipHop Warning: func_get_arg(): Argument 0 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: func_get_arg(): Argument 1 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
int(1)
int(2)
HipHop Warning: func_get_arg(): Argument 2 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: func_get_arg(): The argument number should be >= 0 in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: func_get_arg(): Argument 0 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: func_get_arg(): Argument 1 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: Missing argument 2 for test3() in hphp/test/zend/bad/002.php on line %d
int(1)
HipHop Warning: func_get_arg(): Argument 1 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: func_get_arg(): Argument 2 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
int(1)
int(2)
HipHop Warning: func_get_arg(): Argument 2 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
int(1)
HipHop Warning: func_get_arg(): Argument 1 not passed to function in hphp/test/zend/bad/002.php on line %d
bool(false)
HipHop Warning: func_get_arg(): Called from the global scope - no function context in hphp/test/zend/bad/002.php on line %d
bool(false)
Done
+35
Ver Arquivo
@@ -0,0 +1,35 @@
<?php
function test1() {
var_dump(func_get_args());
}
function test2($a) {
var_dump(func_get_args());
}
function test3($a, $b) {
var_dump(func_get_args());
}
test1();
test1(10);
test2(1);
test2();
test3(1,2);
call_user_func("test1");
call_user_func("test3", 1);
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_get_args());
}
}
test::test1(1);
var_dump(func_get_args());
echo "Done\n";
?>
+42
Ver Arquivo
@@ -0,0 +1,42 @@
array(0) {
}
array(1) {
[0]=>
int(10)
}
array(1) {
[0]=>
int(1)
}
HipHop Warning: Missing argument 1 for test2(), called in hphp/test/zend/bad/003.php on line %d and defined in hphp/test/zend/bad/003.php on line %d
array(0) {
}
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
array(0) {
}
HipHop Warning: Missing argument 2 for test3() in hphp/test/zend/bad/003.php on line %d
array(1) {
[0]=>
int(1)
}
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
array(1) {
[0]=>
int(1)
}
HipHop Warning: func_get_args(): Called from the global scope - no function context in hphp/test/zend/bad/003.php on line %d
bool(false)
Done
+11
Ver Arquivo
@@ -0,0 +1,11 @@
<?php
var_dump(strncmp("", ""));
var_dump(strncmp("", "", 100));
var_dump(strncmp("aef", "dfsgbdf", -1));
var_dump(strncmp("fghjkl", "qwer", 0));
var_dump(strncmp("qwerty", "qwerty123", 6));
var_dump(strncmp("qwerty", "qwerty123", 7));
echo "Done\n";
?>
+10
Ver Arquivo
@@ -0,0 +1,10 @@
HipHop Warning: strncmp() expects exactly 3 parameters, 2 given in hphp/test/zend/bad/004.php on line %d
NULL
int(0)
HipHop Warning: Length must be greater than or equal to 0 in hphp/test/zend/bad/004.php on line %d
bool(false)
int(0)
int(0)
int(-1)
Done
+13
Ver Arquivo
@@ -0,0 +1,13 @@
<?php
var_dump(strcasecmp(""));
var_dump(strcasecmp("", ""));
var_dump(strcasecmp("aef", "dfsgbdf"));
var_dump(strcasecmp("qwe", "qwer"));
var_dump(strcasecmp("qwerty", "QweRty"));
var_dump(strcasecmp("qwErtY", "qwerty"));
var_dump(strcasecmp("q123", "Q123"));
var_dump(strcasecmp("01", "01"));
echo "Done\n";
?>
+10
Ver Arquivo
@@ -0,0 +1,10 @@
HipHop Warning: strcasecmp() expects exactly 2 parameters, 1 given in hphp/test/zend/bad/005.php on line %d
NULL
int(0)
int(-3)
int(-1)
int(0)
int(0)
int(0)
int(0)
Done
+14
Ver Arquivo
@@ -0,0 +1,14 @@
<?php
var_dump(strncasecmp(""));
var_dump(strncasecmp("", "", -1));
var_dump(strncasecmp("aef", "dfsgbdf", 0));
var_dump(strncasecmp("aef", "dfsgbdf", 10));
var_dump(strncasecmp("qwe", "qwer", 3));
var_dump(strncasecmp("qwerty", "QweRty", 6));
var_dump(strncasecmp("qwErtY", "qwer", 7));
var_dump(strncasecmp("q123", "Q123", 3));
var_dump(strncasecmp("01", "01", 1000));
echo "Done\n";
?>
+13
Ver Arquivo
@@ -0,0 +1,13 @@
HipHop Warning: strncasecmp() expects exactly 3 parameters, 1 given in hphp/test/zend/bad/006.php on line %d
NULL
HipHop Warning: Length must be greater than or equal to 0 in hphp/test/zend/bad/006.php on line %d
bool(false)
int(0)
int(-3)
int(0)
int(0)
int(2)
int(0)
int(0)
Done
+20
Ver Arquivo
@@ -0,0 +1,20 @@
<?php
var_dump(each());
$var = 1;
var_dump(each($var));
$var = "string";
var_dump(each($var));
$var = array(1,2,3);
var_dump(each($var));
$var = array("a"=>1,"b"=>2,"c"=>3);
var_dump(each($var));
$a = array(1);
$a [] =&$a[0];
var_dump(each($a));
echo "Done\n";
?>
+39
Ver Arquivo
@@ -0,0 +1,39 @@
HipHop Warning: each() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/007.php on line %d
NULL
HipHop Warning: Variable passed to each() is not an array or object in hphp/test/zend/bad/007.php on line %d
NULL
HipHop Warning: Variable passed to each() is not an array or object in hphp/test/zend/bad/007.php on line %d
NULL
array(4) {
[1]=>
int(1)
["value"]=>
int(1)
[0]=>
int(0)
["key"]=>
int(0)
}
array(4) {
[1]=>
int(1)
["value"]=>
int(1)
[0]=>
string(1) "a"
["key"]=>
string(1) "a"
}
array(4) {
[1]=>
int(1)
["value"]=>
int(1)
[0]=>
int(0)
["key"]=>
int(0)
}
Done
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?php
var_dump(define());
var_dump(define("TRUE"));
var_dump(define("TRUE", 1));
var_dump(define("TRUE", 1, array(1)));
var_dump(define(array(1,2,3,4,5), 1));
var_dump(define(" ", 1));
var_dump(define("[[[", 2));
var_dump(define("test const", 3));
var_dump(define("test const", 3));
var_dump(define("test", array(1)));
var_dump(define("test1", new stdclass));
var_dump(constant(" "));
var_dump(constant("[[["));
var_dump(constant("test const"));
echo "Done\n";
?>
+28
Ver Arquivo
@@ -0,0 +1,28 @@
HipHop Warning: define() expects at least 2 parameters, 0 given in hphp/test/zend/bad/008.php on line %d
NULL
HipHop Warning: define() expects at least 2 parameters, 1 given in hphp/test/zend/bad/008.php on line %d
NULL
bool(true)
HipHop Warning: define() expects parameter 3 to be boolean, array given in hphp/test/zend/bad/008.php on line %d
NULL
HipHop Warning: define() expects parameter 1 to be string, array given in hphp/test/zend/bad/008.php on line %d
NULL
bool(true)
bool(true)
bool(true)
HipHop Notice: Constant test const already defined in hphp/test/zend/bad/008.php on line %d
bool(false)
HipHop Warning: Constants may only evaluate to scalar values in hphp/test/zend/bad/008.php on line %d
bool(false)
HipHop Warning: Constants may only evaluate to scalar values in hphp/test/zend/bad/008.php on line %d
bool(false)
int(1)
int(2)
int(3)
Done
+28
Ver Arquivo
@@ -0,0 +1,28 @@
<?php
class foo {
function bar () {
var_dump(get_class());
}
}
class foo2 extends foo {
}
foo::bar();
foo2::bar();
$f1 = new foo;
$f2 = new foo2;
$f1->bar();
$f2->bar();
var_dump(get_class());
var_dump(get_class("qwerty"));
var_dump(get_class($f1));
var_dump(get_class($f2));
echo "Done\n";
?>
+16
Ver Arquivo
@@ -0,0 +1,16 @@
Strict Standards: Non-static method foo::bar() should not be called statically in hphp/test/zend/bad/009.php on line %d
string(3) "foo"
Strict Standards: Non-static method foo::bar() should not be called statically in hphp/test/zend/bad/009.php on line %d
string(3) "foo"
string(3) "foo"
string(3) "foo"
HipHop Warning: get_class() called without object from outside a class in hphp/test/zend/bad/009.php on line %d
bool(false)
HipHop Warning: get_class() expects parameter 1 to be object, string given in hphp/test/zend/bad/009.php on line %d
bool(false)
string(3) "foo"
string(4) "foo2"
Done
+51
Ver Arquivo
@@ -0,0 +1,51 @@
<?php
class foo {
public $pp1 = 1;
private $pp2 = 2;
protected $pp3 = 3;
function bar() {
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
}
}
class bar extends foo {
function test() {
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
}
}
var_dump(property_exists());
var_dump(property_exists(""));
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
var_dump(property_exists("foo","nonexistent"));
var_dump(property_exists("fo","nonexistent"));
var_dump(property_exists("foo",""));
var_dump(property_exists("","test"));
var_dump(property_exists("",""));
$foo = new foo;
var_dump(property_exists($foo,"pp1"));
var_dump(property_exists($foo,"pp2"));
var_dump(property_exists($foo,"pp3"));
var_dump(property_exists($foo,"nonexistent"));
var_dump(property_exists($foo,""));
var_dump(property_exists(array(),"test"));
var_dump(property_exists(1,"test"));
var_dump(property_exists(true,"test"));
$foo->bar();
$bar = new bar;
$bar->test();
echo "Done\n";
?>
+34
Ver Arquivo
@@ -0,0 +1,34 @@
HipHop Warning: property_exists() expects exactly 2 parameters, 0 given in hphp/test/zend/bad/011.php on line %d
NULL
HipHop Warning: property_exists() expects exactly 2 parameters, 1 given in hphp/test/zend/bad/011.php on line %d
NULL
bool(true)
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
bool(true)
bool(false)
bool(false)
HipHop Warning: First parameter must either be an object or the name of an existing class in hphp/test/zend/bad/011.php on line %d
NULL
HipHop Warning: First parameter must either be an object or the name of an existing class in hphp/test/zend/bad/011.php on line %d
NULL
HipHop Warning: First parameter must either be an object or the name of an existing class in hphp/test/zend/bad/011.php on line %d
NULL
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
Done
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<?php
class foo {
}
var_dump(class_exists());
var_dump(class_exists("qwerty"));
var_dump(class_exists(""));
var_dump(class_exists(array()));
var_dump(class_exists("test", false));
var_dump(class_exists("foo", false));
var_dump(class_exists("foo"));
var_dump(class_exists("stdClass", false));
var_dump(class_exists("stdClass"));
echo "Done\n";
?>
+13
Ver Arquivo
@@ -0,0 +1,13 @@
HipHop Warning: class_exists() expects at least 1 parameter, 0 given in hphp/test/zend/bad/012.php on line %d
NULL
bool(false)
bool(false)
HipHop Warning: class_exists() expects parameter 1 to be string, array given in hphp/test/zend/bad/012.php on line %d
NULL
bool(false)
bool(true)
bool(true)
bool(true)
bool(true)
Done
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<?php
interface foo {
}
var_dump(interface_exists());
var_dump(interface_exists("qwerty"));
var_dump(interface_exists(""));
var_dump(interface_exists(array()));
var_dump(interface_exists("test", false));
var_dump(interface_exists("foo", false));
var_dump(interface_exists("foo"));
var_dump(interface_exists("stdClass", false));
var_dump(interface_exists("stdClass"));
echo "Done\n";
?>
+13
Ver Arquivo
@@ -0,0 +1,13 @@
HipHop Warning: interface_exists() expects at least 1 parameter, 0 given in hphp/test/zend/bad/013.php on line %d
NULL
bool(false)
bool(false)
HipHop Warning: interface_exists() expects parameter 1 to be string, array given in hphp/test/zend/bad/013.php on line %d
NULL
bool(false)
bool(true)
bool(true)
bool(false)
bool(false)
Done
+19
Ver Arquivo
@@ -0,0 +1,19 @@
<?php
var_dump(get_included_files());
include(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());
var_dump(get_included_files(1,1));
include_once(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());
var_dump(get_included_files(1));
include(dirname(__FILE__)."/014.inc");
var_dump(get_included_files());
echo "Done\n";
?>
+29
Ver Arquivo
@@ -0,0 +1,29 @@
array(1) {
[0]=>
string(%d) "%s"
}
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}
HipHop Warning: get_included_files() expects exactly 0 parameters, 2 given in hphp/test/zend/bad/014.php on line %d
NULL
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}
HipHop Warning: get_included_files() expects exactly 0 parameters, 1 given in hphp/test/zend/bad/014.php on line %d
NULL
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}
Done
+12
Ver Arquivo
@@ -0,0 +1,12 @@
<?php
var_dump(trigger_error());
var_dump(trigger_error("error"));
var_dump(trigger_error(array()));
var_dump(trigger_error("error", -1));
var_dump(trigger_error("error", 0));
var_dump(trigger_error("error", E_USER_WARNING));
var_dump(trigger_error("error", E_USER_DEPRECATED));
echo "Done\n";
?>
+21
Ver Arquivo
@@ -0,0 +1,21 @@
HipHop Warning: trigger_error() expects at least 1 parameter, 0 given in hphp/test/zend/bad/015.php on line %d
NULL
HipHop Notice: error in hphp/test/zend/bad/015.php on line %d
bool(true)
HipHop Warning: trigger_error() expects parameter 1 to be string, array given in hphp/test/zend/bad/015.php on line %d
NULL
HipHop Warning: Invalid error type specified in hphp/test/zend/bad/015.php on line %d
bool(false)
HipHop Warning: Invalid error type specified in hphp/test/zend/bad/015.php on line %d
bool(false)
HipHop Warning: error in hphp/test/zend/bad/015.php on line %d
bool(true)
Deprecated: error in hphp/test/zend/bad/015.php on line %d
bool(true)
Done
+43
Ver Arquivo
@@ -0,0 +1,43 @@
<?php
var_dump(get_resource_type());
var_dump(get_resource_type(""));
$fp = fopen(__FILE__, "r");
var_dump(get_resource_type($fp));
fclose($fp);
var_dump(get_resource_type($fp));
var_dump(gettype(get_loaded_extensions()));
var_dump(count(get_loaded_extensions()));
var_dump(gettype(get_loaded_extensions(true)));
var_dump(count(get_loaded_extensions(true)));
var_dump(get_loaded_extensions(true, true));
define("USER_CONSTANT", "test");
var_dump(get_defined_constants(true, true));
var_dump(gettype(get_defined_constants(true)));
var_dump(gettype(get_defined_constants()));
var_dump(count(get_defined_constants()));
function test () {
}
var_dump(get_defined_functions(true));
var_dump(gettype(get_defined_functions()));
var_dump(count(get_defined_functions()));
var_dump(get_declared_interfaces(true));
var_dump(gettype(get_declared_interfaces()));
var_dump(count(get_declared_interfaces()));
var_dump(get_extension_funcs());
var_dump(get_extension_funcs(true));
var_dump(gettype(get_extension_funcs("standard")));
var_dump(count(get_extension_funcs("standard")));
var_dump(gettype(get_extension_funcs("zend")));
var_dump(count(get_extension_funcs("zend")));
echo "Done\n";
?>
+39
Ver Arquivo
@@ -0,0 +1,39 @@
HipHop Warning: get_resource_type() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/017.php on line %d
NULL
HipHop Warning: get_resource_type() expects parameter 1 to be resource, string given in hphp/test/zend/bad/017.php on line %d
NULL
string(6) "stream"
string(7) "Unknown"
string(5) "array"
int(%d)
string(5) "array"
int(%d)
HipHop Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in hphp/test/zend/bad/017.php on line %d
NULL
HipHop Warning: get_defined_constants() expects at most 1 parameter, 2 given in hphp/test/zend/bad/017.php on line %d
NULL
string(5) "array"
string(5) "array"
int(%d)
HipHop Warning: get_defined_functions() expects exactly 0 parameters, 1 given in hphp/test/zend/bad/017.php on line %d
NULL
string(5) "array"
int(%d)
HipHop Warning: get_declared_interfaces() expects exactly 0 parameters, 1 given in hphp/test/zend/bad/017.php on line %d
NULL
string(5) "array"
int(%d)
HipHop Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/017.php on line %d
NULL
bool(false)
string(5) "array"
int(%d)
string(5) "array"
int(%d)
Done
+16
Ver Arquivo
@@ -0,0 +1,16 @@
<?php
var_dump(constant());
var_dump(constant("", ""));
var_dump(constant(""));
var_dump(constant(array()));
define("TEST_CONST", 1);
var_dump(constant("TEST_CONST"));
define("TEST_CONST2", "test");
var_dump(constant("TEST_CONST2"));
echo "Done\n";
?>
+14
Ver Arquivo
@@ -0,0 +1,14 @@
HipHop Warning: constant() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/018.php on line %d
NULL
HipHop Warning: constant() expects exactly 1 parameter, 2 given in hphp/test/zend/bad/018.php on line %d
NULL
HipHop Warning: constant(): Couldn't find constant in hphp/test/zend/bad/018.php on line %d
NULL
HipHop Warning: constant() expects parameter 1 to be string, array given in hphp/test/zend/bad/018.php on line %d
NULL
int(1)
string(4) "test"
Done
+360
Ver Arquivo
@@ -0,0 +1,360 @@
<?php
/* Prototype: void unset ( mixed $var [, mixed $var [, mixed $...]] );
Description: unset() destroys the specified variables
Prototype: bool empty( mixed $var );
Description: Determine whether a variable is considered to be empty
Prototype: bool isset ( mixed $var [, mixed $var [, $...]] );
Description: Returns TRUE if var exists; FALSE otherwise
*/
echo "*** Testing unset(), empty() & isset() with scalar variables ***\n";
// testing scalar variables
$scalar_variables = array(
0,
1,
+1
-1,
0x55,
-0xFA,
0123,
-0563,
0.0,
1e5,
1E-5,
-1.5e5,
+5.6,
"",
'',
" ",
' ',
"string",
"123",
"0",
"ture",
"FALSE",
"NULL",
"null",
true,
false,
TRUE,
FALSE
);
$loop_counter = 1;
foreach ($scalar_variables as $scalar_var) {
$set_var = 10; // this variable to use with isset
echo "-- Iteration $loop_counter --\n"; $loop_counter++;
// checking with isset before unsetting, expected: bool(true)
var_dump( isset($scalar_var) );
var_dump( isset($scalar_var, $set_var) );
// checking if the var is empty, expected: bool(false) on most
// except "", 0, "0", NULL, FALSE
var_dump( empty($scalar_var) );
// destroy the variable using unset
unset( $scalar_var );
// dump and see if its destroyed, expcted: NULL
var_dump( $scalar_var );
// check using isset to see if unset, expected: bool(false)
var_dump( isset($scalar_var) );
var_dump( isset($scalar_var, $set_var) );
// empty to check if empty, expecting bool(true)
var_dump( empty($scalar_var) );
// isset() with two args, one arg only unset, expected: bool(false)
var_dump( isset($scalar_var, $set_var) );
// isset() with two args, both args already unset, expected: bool(false);
unset($set_var);
var_dump( isset($scalar_var, $set_var) );
}
echo "\n*** Testing unset(), empty() & isset() with arrays ***\n";
$array_variables = array(
array(),
array(NULL),
array(0),
array("0"),
array(""),
array(1,2,3,4),
array(1.4,2.5,5.6),
array(1 => "One", 2 => "two"),
array("Name" => "Jack", "Age" => "30"),
array(1,2, "One" => "1", 2 => "two", ""=>"empty", "" => '')
);
$outer_loop_counter = 1;
foreach ($array_variables as $array_var) {
echo "--- Outerloop Iteration $outer_loop_counter ---\n";
// check the isset and unset on non existing key
$var = 1; // a var which is defined
// try to unset the element which is non-existent
unset($array_var['non_existent']);
// check using isset() & empty() on a non_existent element in the array
var_dump( isset($array_var['non_existent']) );
var_dump( isset($array_var['non_existent'], $var) );
var_dump( isset($array_var['non_existent'], $array_var['none']) );
var_dump( empty($array_var['non_existent']) );
// testing empty and isset on arrays
var_dump( empty($array_var) ); // expecting bool(false), except: array(), which is considered empty
var_dump( isset($array_var) ); // expecting bool(true), except: array(), which is not set
// get the keys of the $array_var
$keys = array_keys($array_var);
// unset each element in the array and see the working of unset, isset & empty
$inner_loop_counter = 1;
foreach ($keys as $key_value) {
echo "-- Innerloop Iteration $inner_loop_counter of Outerloop Iteration $outer_loop_counter --\n";
$inner_loop_counter++;
// unset the element
unset($array_var[$key_value]);
// dump the array after element was unset
var_dump($array_var);
// check using isset for the element that was unset
var_dump( isset($array_var[$key_val]) ); // expected: bool(false)
// calling isset with more args
var_dump( isset($array_var[$key_val], $array_var) ); //expected: bool(false)
// calling empty, expected bool(true)
var_dump( empty($array_var[$key_val]) );
// dump the array to see that that array did not get modified
// because of using isset, empty and unset on its element
var_dump($array_var);
}
$outer_loop_counter++;
// unset the whole array
unset($array_var);
// dump the array to see its unset
var_dump($array_var);
// use isset to see that array is not set
var_dump( isset($array_var) ); //expected: bool(false)
var_dump( isset($array_var, $array_var[$key_val]) ); // expected: bool(false)
// empty() to see if the array is empty
var_dump( empty($array_var) ); // expected: bool(true)
}
echo "\n*** Testing unset(), emtpy() & isset() with resource variables ***\n";
$fp = fopen(__FILE__, "r");
$dfp = opendir( dirname(__FILE__) );
$resources = array (
$fp,
$dfp
);
$loop_counter = 1;
foreach ($resources as $resource) {
$temp_var = 10;
echo "-- Iteration $loop_counter --\n"; $loop_counter++;
//dump the resource first
var_dump($resource);
// check using isset() and empty()
var_dump( isset($resource) ); // expected: bool(true)
var_dump( empty($resource) ); // expected: bool(false)
// call isset() with two args, both set
var_dump( isset($resource, $temp_var) ); // expected: bool(true)
// dump the resource to see using isset() and empty () had no effect on it
var_dump($resource);
// unset the resource
unset($resource);
// check using isset() and empty()
var_dump( isset($resource) ); // expected: bool(flase)
var_dump( empty($resource) ); // expected: bool(true)
// call isset() with two args, but one set
var_dump( isset($resource, $temp_var) ); // expected: bool(false)
// uset the temp_var
unset($temp_var);
// now the isset() with both the args as unset
var_dump( isset($resource, $temp_var) ); // expected: bool(false);
// dump the resource to see if there any effect on it
var_dump($resource);
}
// unset and dump the array containing all the resources to see that
// unset works correctly
unset($resources);
var_dump($resources);
var_dump( isset($resources) ); //expected: bool(false)
var_dump( empty($resources) ); // expected: bool(true)
echo "\n*** Testing unset(), empty() & isset() with objects ***\n";
class Point
{
var $x;
var $y;
var $lable;
function Point($x, $y) {
$this->x = $x;
$this->y = $y;
}
function setLable($lable) {
$this->lable = $lable;
}
function testPoint() {
echo "\nPoint::testPoint() called\n";
}
}
$point1 = new Point(30,40);
// use unset/empty/isset to check the object
var_dump($point1); // dump the object
// check the object and member that is not set
var_dump( isset($point1) ); // expected: bool(true)
var_dump( empty($point1) ); // expected: bool(false)
var_dump( isset($point1->$lable) ); //expected: bool(flase)
var_dump( empty($point1->$lable) ); //expected: bool(true)
//set the member variable lable and check
$point1->setLable("Point1");
var_dump( isset($point1->$lable) ); //expected: bool(true)
var_dump( empty($point1->$lable) ); //expected: bool(false)
// dump the object to see that obj was not harmed
// because of the usage of the isset & empty
var_dump($point1);
//unset a member and check
unset($point1->x);
// dump the point to see that variable was unset
var_dump($point1);
var_dump( isset($point1->x) ); // expected: bool(false)
var_dump( empty($point1->x) ); // expected: bool(true)
// unset all members and check
unset($point1->y);
unset($point1->lable);
// dump the objec to check that all variables are unset
var_dump($point1);
var_dump( isset($point1) ); // expected: bool(ture)
var_dump( empty($point1) ); // expected: bool(false)
//unset the object and check
unset($point1);
var_dump( isset($point1) ); // expected: bool(false)
var_dump( empty($point1) ); // expected: bool(true)
// dump to see that object is unset
var_dump($point1);
// try isset/unset/empty on a member function
$point2 = new Point(5,6);
var_dump( isset($point2->testPoint) );
var_dump( empty($point2->testPoint) );
unset($point2->testPoint);
var_dump( isset($point2->testPoint) );
var_dump( empty($point2->testPoint) );
// use get_class_methods to see effect if any
var_dump( get_class_methods($point2) );
// dump the object to see the effect, none expected
var_dump($point2);
/* testing variation in operation for isset(), empty() & unset().
Note: Most of the variation for function unset() is testing by a
set of testcases named "Zend/tests/unset_cv??.phpt", only
variation not tested are attempted here */
echo "\n*** Testing possible variation in operation for isset(), empty() & unset() ***\n";
/* unset() variation1: checking unset on static variable inside a function.
* unset() destroys the variable only in the context of the rest of a function
* Following calls will restore the previous value of a variable.
*/
echo "\n** Testing unset() variation 1: unset on static variable inside a function **\n";
function test_unset1() {
static $static_var;
// increment the value of the static. this change is in function context
$static_var ++;
echo "value of static_var before unset: $static_var\n";
// check using isset and empty
var_dump( isset($static_var) );
var_dump( empty($static_var) );
// unset the static var
unset($static_var);
echo "value of static_var after unset: $static_var\n";
// check using isset and empty
var_dump( isset($static_var) );
var_dump( empty($static_var) );
// assign a value to static var
$static_var = 20;
echo "value of static_var after new assignment: $static_var\n";
}
// call the functiont
test_unset1();
test_unset1();
test_unset1();
echo "\n** Testing unset() variation 2: unset on a variable passed by ref. inside of a function **\n";
/* unset() variation2: Pass by reference
* If a variable that is PASSED BY REFERENCE is unset() inside of a function,
* only the local variable is destroyed. The variable in the calling environment
* will retain the same value as before unset() was called.
*/
function test_unset2( &$ref_val ) {
// unset the variable passed
unset($ref_val);
// check using isset and empty to confirm
var_dump( isset($ref_val) );
var_dump( empty($ref_val) );
// set the value ot a new one
$ref_val = "new value by ref";
}
$value = "value";
var_dump($value);
test_unset2($value);
var_dump($value);
echo "\n** Testing unset() variation 3: unset on a global variable inside of a function **\n";
/* unset() variation2: unset on a global variable inside a function
* If a globalized variable is unset() inside of a function, only the
* local variable is destroyed. The variable in the calling environment
* will retain the same value as before unset() was called.
*/
$global_var = 10;
function test_unset3() {
global $global_var;
// check the $global_var using isset and empty
var_dump( isset($global_var) );
var_dump( empty($global_var) );
// unset the global var
unset($global_var);
// check the $global_var using isset and empty
var_dump( isset($global_var) );
var_dump( empty($global_var) );
}
var_dump($global_var);
test_unset3();
var_dump($global_var);
//Note: No error conditions relating to passing arugments can be tested
// because these are not functions but statements, it will result in syntax error.
?>
===DONE===
+969
Ver Arquivo
@@ -0,0 +1,969 @@
*** Testing unset(), empty() & isset() with scalar variables ***
-- Iteration 1 --
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 2 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 3 --
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 4 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 5 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 6 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 7 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 8 --
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 9 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 10 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 11 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 12 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 13 --
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 14 --
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 15 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 16 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 17 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 18 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 19 --
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 20 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 21 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 22 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 23 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 24 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 25 --
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 26 --
bool(true)
bool(true)
bool(false)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 27 --
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined variable: scalar_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
*** Testing unset(), empty() & isset() with arrays ***
--- Outerloop Iteration 1 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 2 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 2 --
array(0) {
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(0) {
}
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 3 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 3 --
array(0) {
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(0) {
}
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 4 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 4 --
array(0) {
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(0) {
}
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 5 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 5 --
array(0) {
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(0) {
}
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 6 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 6 --
array(3) {
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(3) {
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
}
-- Innerloop Iteration 2 of Outerloop Iteration 6 --
array(2) {
[2]=>
int(3)
[3]=>
int(4)
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(2) {
[2]=>
int(3)
[3]=>
int(4)
}
-- Innerloop Iteration 3 of Outerloop Iteration 6 --
array(1) {
[3]=>
int(4)
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(1) {
[3]=>
int(4)
}
-- Innerloop Iteration 4 of Outerloop Iteration 6 --
array(0) {
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(0) {
}
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 7 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 7 --
array(2) {
[1]=>
float(2.5)
[2]=>
float(5.6)
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(2) {
[1]=>
float(2.5)
[2]=>
float(5.6)
}
-- Innerloop Iteration 2 of Outerloop Iteration 7 --
array(1) {
[2]=>
float(5.6)
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(1) {
[2]=>
float(5.6)
}
-- Innerloop Iteration 3 of Outerloop Iteration 7 --
array(0) {
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(0) {
}
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 8 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 8 --
array(1) {
[2]=>
string(3) "two"
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(1) {
[2]=>
string(3) "two"
}
-- Innerloop Iteration 2 of Outerloop Iteration 8 --
array(0) {
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(0) {
}
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 9 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 9 --
array(1) {
["Age"]=>
string(2) "30"
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(1) {
["Age"]=>
string(2) "30"
}
-- Innerloop Iteration 2 of Outerloop Iteration 9 --
array(0) {
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(0) {
}
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 10 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 10 --
array(4) {
[1]=>
int(2)
["One"]=>
string(1) "1"
[2]=>
string(3) "two"
[""]=>
string(0) ""
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(4) {
[1]=>
int(2)
["One"]=>
string(1) "1"
[2]=>
string(3) "two"
[""]=>
string(0) ""
}
-- Innerloop Iteration 2 of Outerloop Iteration 10 --
array(3) {
["One"]=>
string(1) "1"
[2]=>
string(3) "two"
[""]=>
string(0) ""
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(3) {
["One"]=>
string(1) "1"
[2]=>
string(3) "two"
[""]=>
string(0) ""
}
-- Innerloop Iteration 3 of Outerloop Iteration 10 --
array(2) {
[2]=>
string(3) "two"
[""]=>
string(0) ""
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(2) {
[2]=>
string(3) "two"
[""]=>
string(0) ""
}
-- Innerloop Iteration 4 of Outerloop Iteration 10 --
array(1) {
[""]=>
string(0) ""
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(1) {
[""]=>
string(0) ""
}
-- Innerloop Iteration 5 of Outerloop Iteration 10 --
array(0) {
}
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: key_val in hphp/test/zend/bad/019.php on line %d
bool(true)
array(0) {
}
HipHop Notice: Undefined variable: array_var in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(false)
bool(true)
*** Testing unset(), emtpy() & isset() with resource variables ***
-- Iteration 1 --
resource(%d) of type (stream)
bool(true)
bool(false)
bool(true)
resource(%d) of type (stream)
bool(false)
bool(true)
bool(false)
bool(false)
HipHop Notice: Undefined variable: resource in hphp/test/zend/bad/019.php on line %d
NULL
-- Iteration 2 --
resource(%d) of type (stream)
bool(true)
bool(false)
bool(true)
resource(%d) of type (stream)
bool(false)
bool(true)
bool(false)
bool(false)
HipHop Notice: Undefined variable: resource in hphp/test/zend/bad/019.php on line %d
NULL
HipHop Notice: Undefined variable: resources in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(true)
*** Testing unset(), empty() & isset() with objects ***
object(Point)#%d (3) {
["x"]=>
int(30)
["y"]=>
int(40)
["lable"]=>
NULL
}
bool(true)
bool(false)
HipHop Notice: Undefined variable: lable in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: lable in hphp/test/zend/bad/019.php on line %d
bool(true)
HipHop Notice: Undefined variable: lable in hphp/test/zend/bad/019.php on line %d
bool(false)
HipHop Notice: Undefined variable: lable in hphp/test/zend/bad/019.php on line %d
bool(true)
object(Point)#%d (3) {
["x"]=>
int(30)
["y"]=>
int(40)
["lable"]=>
string(6) "Point1"
}
object(Point)#%d (2) {
["y"]=>
int(40)
["lable"]=>
string(6) "Point1"
}
bool(false)
bool(true)
object(Point)#%d (0) {
}
bool(true)
bool(false)
bool(false)
bool(true)
HipHop Notice: Undefined variable: point1 in hphp/test/zend/bad/019.php on line %d
NULL
bool(false)
bool(true)
bool(false)
bool(true)
array(3) {
[0]=>
string(5) "Point"
[1]=>
string(8) "setLable"
[2]=>
string(9) "testPoint"
}
object(Point)#%d (3) {
["x"]=>
int(5)
["y"]=>
int(6)
["lable"]=>
NULL
}
*** Testing possible variation in operation for isset(), empty() & unset() ***
** Testing unset() variation 1: unset on static variable inside a function **
value of static_var before unset: 1
bool(true)
bool(false)
HipHop Notice: Undefined variable: static_var in hphp/test/zend/bad/019.php on line %d
value of static_var after unset:
bool(false)
bool(true)
value of static_var after new assignment: 20
value of static_var before unset: 2
bool(true)
bool(false)
HipHop Notice: Undefined variable: static_var in hphp/test/zend/bad/019.php on line %d
value of static_var after unset:
bool(false)
bool(true)
value of static_var after new assignment: 20
value of static_var before unset: 3
bool(true)
bool(false)
HipHop Notice: Undefined variable: static_var in hphp/test/zend/bad/019.php on line %d
value of static_var after unset:
bool(false)
bool(true)
value of static_var after new assignment: 20
** Testing unset() variation 2: unset on a variable passed by ref. inside of a function **
string(5) "value"
bool(false)
bool(true)
string(5) "value"
** Testing unset() variation 3: unset on a global variable inside of a function **
int(10)
bool(true)
bool(false)
bool(false)
bool(true)
int(10)
===DONE===
+18
Ver Arquivo
@@ -0,0 +1,18 @@
<?php
var_dump(func_get_arg(1,2,3));
var_dump(func_get_arg(1));
var_dump(func_get_arg());
function bar() {
var_dump(func_get_arg(1));
}
function foo() {
bar(func_get_arg(1));
}
foo(1,2);
echo "Done\n";
?>
+12
Ver Arquivo
@@ -0,0 +1,12 @@
HipHop Warning: func_get_arg() expects exactly 1 parameter, 3 given in hphp/test/zend/bad/020.php on line %d
NULL
HipHop Warning: func_get_arg(): Called from the global scope - no function context in hphp/test/zend/bad/020.php on line %d
bool(false)
HipHop Warning: func_get_arg() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/020.php on line %d
NULL
HipHop Warning: func_get_arg(): Argument 1 not passed to function in hphp/test/zend/bad/020.php on line %d
bool(false)
Done
+13
Ver Arquivo
@@ -0,0 +1,13 @@
<?php
var_dump($a[1]);
var_dump($a[$c]);
var_dump($a + 1);
var_dump($a + $b);
var_dump($a++);
var_dump(++$b);
var_dump($a->$b);
var_dump($a->$b);
var_dump($a->$b->$c[1]);
?>
+34
Ver Arquivo
@@ -0,0 +1,34 @@
HipHop Notice: Undefined variable: a in hphp/test/zend/bad/024.php on line %d
NULL
HipHop Notice: Undefined variable: %s in hphp/test/zend/bad/024.php on line %d
HipHop Notice: Undefined variable: %s in hphp/test/zend/bad/024.php on line %d
NULL
HipHop Notice: Undefined variable: a in hphp/test/zend/bad/024.php on line %d
int(1)
HipHop Notice: Undefined variable: %s in hphp/test/zend/bad/024.php on line %d
HipHop Notice: Undefined variable: %s in hphp/test/zend/bad/024.php on line %d
int(0)
HipHop Notice: Undefined variable: a in hphp/test/zend/bad/024.php on line %d
NULL
HipHop Notice: Undefined variable: b in hphp/test/zend/bad/024.php on line %d
int(1)
HipHop Notice: Trying to get property of non-object in hphp/test/zend/bad/024.php on line %d
NULL
HipHop Notice: Trying to get property of non-object in hphp/test/zend/bad/024.php on line %d
NULL
HipHop Notice: Undefined variable: c in hphp/test/zend/bad/024.php on line %d
HipHop Notice: Trying to get property of non-object in hphp/test/zend/bad/024.php on line %d
HipHop Notice: Trying to get property of non-object in hphp/test/zend/bad/024.php on line %d
NULL
+16
Ver Arquivo
@@ -0,0 +1,16 @@
<?php
class foo {
public function a() {
}
}
$test = new foo;
$test->a()->a;
print "ok\n";
$test->a()->a = 1;
print "ok\n";
?>
+5
Ver Arquivo
@@ -0,0 +1,5 @@
HipHop Notice: Trying to get property of non-object in hphp/test/zend/bad/026.php on line %d
ok
HipHop Warning: Creating default object from empty value in hphp/test/zend/bad/026.php on line %d
ok
+12
Ver Arquivo
@@ -0,0 +1,12 @@
<?php
$arr = array('strtoupper', 'strtolower');
$k = 0;
var_dump($arr[0]('foo') == 'FOO');
var_dump($arr[$k]('foo') == 'FOO');
var_dump($arr[++$k]('FOO') == 'foo');
var_dump($arr[++$k]('FOO') == 'foo');
?>
+7
Ver Arquivo
@@ -0,0 +1,7 @@
bool(true)
bool(true)
bool(true)
HipHop Notice: Undefined offset: 2 in hphp/test/zend/bad/028.php on line %d
HipHop Fatal error: Function name must be a string in hphp/test/zend/bad/028.php on line %d
+29
Ver Arquivo
@@ -0,0 +1,29 @@
<?php
class foo {
public $test = 0;
private $test_2 = 1;
protected $test_3 = 2;
public function bar() {
try {
throw new Exception('foo');
} catch (Exception $this) {
var_dump($this);
}
$this->baz();
}
public function baz() {
foreach ($this as $k => $v) {
printf("'%s' => '%s'\n", $k, $v);
}
print "ok\n";
}
}
$test = new foo;
$test->bar();
?>
+37
Ver Arquivo
@@ -0,0 +1,37 @@
object(Exception)#%d (7) {
["message":protected]=>
string(3) "foo"
["string":"Exception":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(%d) "%s030.php"
["line":protected]=>
int(%d)
["trace":"Exception":private]=>
array(1) {
[0]=>
array(6) {
["file"]=>
string(%d) "%s030.php"
["line"]=>
int(%d)
["function"]=>
string(3) "bar"
["class"]=>
string(3) "foo"
["type"]=>
string(2) "->"
["args"]=>
array(0) {
}
}
}
["previous":"Exception":private]=>
NULL
}
'test' => '0'
'test_2' => '1'
'test_3' => '2'
ok
+6
Ver Arquivo
@@ -0,0 +1,6 @@
<?php
function test($var) { }
test($arr[]);
?>
+1
Ver Arquivo
@@ -0,0 +1 @@
HipHop Fatal error: Cannot use [] for reading in hphp/test/zend/bad/031.php on line %d
+15
Ver Arquivo
@@ -0,0 +1,15 @@
<?php
$arr[1][2][3][4][5];
echo $arr[1][2][3][4][5];
$arr[1][2][3][4][5]->foo;
$arr[1][2][3][4][5]->foo = 1;
$arr[][] = 2;
$arr[][]->bar = 2;
?>
+11
Ver Arquivo
@@ -0,0 +1,11 @@
HipHop Notice: Undefined variable: arr in hphp/test/zend/bad/033.php on line %d
HipHop Notice: Undefined variable: arr in hphp/test/zend/bad/033.php on line %d
HipHop Notice: Undefined variable: arr in hphp/test/zend/bad/033.php on line %d
HipHop Notice: Trying to get property of non-object in hphp/test/zend/bad/033.php on line %d
HipHop Warning: Creating default object from empty value in hphp/test/zend/bad/033.php on line %d
HipHop Warning: Creating default object from empty value in hphp/test/zend/bad/033.php on line %d
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?php
switch (1) {
case 2:
print 'foo';
break;
case 3:
print 'bar';
break;
default:
print 1;
break;
default:
print 2;
break;
default:
print 3;
break;
}
?>
+1
Ver Arquivo
@@ -0,0 +1 @@
3
+6
Ver Arquivo
@@ -0,0 +1,6 @@
<?php
$test[function(){}] = 1;
$a{function() { }} = 1;
?>
+3
Ver Arquivo
@@ -0,0 +1,3 @@
HipHop Warning: Illegal offset type in hphp/test/zend/bad/036.php on line %d
HipHop Warning: Illegal offset type in hphp/test/zend/bad/036.php on line %d
+12
Ver Arquivo
@@ -0,0 +1,12 @@
<?php
namespace closure;
class closure { static $x = 1;}
$x = __NAMESPACE__;
var_dump(closure::$x);
var_dump($x::$x);
?>
+3
Ver Arquivo
@@ -0,0 +1,3 @@
int(1)
HipHop Fatal error: Access to undeclared static property: Closure::$x in hphp/test/zend/bad/037.php on line %d
+5
Ver Arquivo
@@ -0,0 +1,5 @@
<?php
var_dump(array(function() { } => 1));
?>
+3
Ver Arquivo
@@ -0,0 +1,3 @@
HipHop Warning: Illegal offset type in hphp/test/zend/bad/038.php on line %d
array(0) {
}
+14
Ver Arquivo
@@ -0,0 +1,14 @@
<?php
error_reporting(E_ALL);
trait THello {
public abstract function hello();
}
class TraitsTest {
use THello;
}
$test = new TraitsTest();
$test->hello();
?>
@@ -0,0 +1 @@
HipHop Fatal error: Class %s contains %d abstract method and must therefore be declared abstract or implement the remaining methods (%s) in hphp/test/zend/bad/abstract-methods01.php on line %d
+20
Ver Arquivo
@@ -0,0 +1,20 @@
<?php
error_reporting(E_ALL);
trait THelloB {
public function hello() {
echo 'Hello';
}
}
trait THelloA {
public abstract function hello($a);
}
class TraitsTest1 {
use THelloB;
use THelloA;
}
?>
@@ -0,0 +1 @@
HipHop Fatal error: Declaration of THelloA::hello($a) must be compatible with THelloB::hello() in hphp/test/zend/bad/abstract-methods05.php on line %d
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?php
error_reporting(E_ALL);
trait THelloB {
public function hello() {
echo 'Hello';
}
}
trait THelloA {
public abstract function hello($a);
}
class TraitsTest1 {
use THelloA;
use THelloB;
}
?>
@@ -0,0 +1 @@
HipHop Fatal error: Declaration of THelloB::hello() must be compatible with THelloA::hello($a) in hphp/test/zend/bad/abstract-methods06.php on line %d
+7
Ver Arquivo
@@ -0,0 +1,7 @@
<?php
abstract class TestClass
{
abstract static public function getName();
}
?>
===DONE===
+2
Ver Arquivo
@@ -0,0 +1,2 @@
Strict Standards: Static function TestClass::getName() should not be abstract in %sabstract-static.php on line %d
===DONE===
@@ -0,0 +1,9 @@
<?php
class test {
static public public static final public final function foo() {
}
}
echo "Done\n";
?>
@@ -0,0 +1 @@
HipHop Fatal error: Multiple access type modifiers are not allowed in hphp/test/zend/bad/access_modifiers_001.php on line %d
@@ -0,0 +1,8 @@
<?php
class test {
static public public static final public final $var;
}
echo "Done\n";
?>
@@ -0,0 +1 @@
HipHop Fatal error: Multiple access type modifiers are not allowed in hphp/test/zend/bad/access_modifiers_002.php on line %d
@@ -0,0 +1,8 @@
<?php
final final class test {
function foo() {}
}
echo "Done\n";
?>
@@ -0,0 +1 @@
Parse error: %s error,%sexpecting %s in hphp/test/zend/bad/access_modifiers_003.php on line %d
@@ -0,0 +1,9 @@
<?php
class test {
abstract abstract function foo() {
}
}
echo "Done\n";
?>
@@ -0,0 +1 @@
HipHop Fatal error: Multiple abstract modifiers are not allowed in hphp/test/zend/bad/access_modifiers_004.php on line %d
@@ -0,0 +1,9 @@
<?php
class test {
final final function foo() {
}
}
echo "Done\n";
?>
@@ -0,0 +1 @@
HipHop Fatal error: Multiple final modifiers are not allowed in hphp/test/zend/bad/access_modifiers_005.php on line %d
@@ -0,0 +1,9 @@
<?php
class test {
static static function foo() {
}
}
echo "Done\n";
?>
@@ -0,0 +1 @@
HipHop Fatal error: Multiple static modifiers are not allowed in hphp/test/zend/bad/access_modifiers_006.php on line %d
@@ -0,0 +1,8 @@
<?php
class test {
final abstract function foo();
}
echo "Done\n";
?>
@@ -0,0 +1 @@
HipHop Fatal error: Cannot use the final modifier on an abstract class member in hphp/test/zend/bad/access_modifiers_007.php on line %d
+14
Ver Arquivo
@@ -0,0 +1,14 @@
<?php
class A {
static protected function f() {return 'A::f()';}
}
class B1 extends A {
static protected function f() {return 'B1::f()';}
}
class B2 extends A {
static public function test() {echo B1::f();}
}
B2::test();
?>
@@ -0,0 +1 @@
HipHop Fatal error: Call to protected method B1::f() from context 'B2' in hphp/test/zend/bad/access_modifiers_008.php on line %d
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<?php
class A {
static protected function f() {return 'A::f()';}
}
class B1 extends A {
static protected function f() {return 'B1::f()';}
}
class B2 extends A {
static public function test() {
var_dump(is_callable('B1::f'));
B1::f();
}
}
B2::test();
?>
@@ -0,0 +1,3 @@
bool(false)
HipHop Fatal error: Call to protected method B1::f() from context 'B2' in hphp/test/zend/bad/access_modifiers_009.php on line %d
+26
Ver Arquivo
@@ -0,0 +1,26 @@
<?php
class d {
private function test2() {
print "Bar\n";
}
}
abstract class a extends d {
public function test() {
$this->test2();
}
}
abstract class b extends a {
}
class c extends b {
public function __construct() {
$this->test();
}
}
new c;
?>
@@ -0,0 +1 @@
HipHop Fatal error: Call to private method d::test2() from context 'a' in hphp/test/zend/bad/access_modifiers_010.php on line %d
+12
Ver Arquivo
@@ -0,0 +1,12 @@
<?php
$a = array(1,2,3);
$o = new stdclass;
$o->prop = "value";
$c = $a + $o;
var_dump($c);
echo "Done\n";
?>
+3
Ver Arquivo
@@ -0,0 +1,3 @@
HipHop Notice: Object of class stdClass could not be converted to int in hphp/test/zend/bad/add_002.php on line %d
HipHop Fatal error: Unsupported operand types in hphp/test/zend/bad/add_002.php on line %d
+12
Ver Arquivo
@@ -0,0 +1,12 @@
<?php
$a = array(1,2,3);
$o = new stdclass;
$o->prop = "value";
$c = $o + $a;
var_dump($c);
echo "Done\n";
?>
+3
Ver Arquivo
@@ -0,0 +1,3 @@
HipHop Notice: Object of class stdClass could not be converted to int in hphp/test/zend/bad/add_003.php on line %d
HipHop Fatal error: Unsupported operand types in hphp/test/zend/bad/add_003.php on line %d
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
$a = array(1,2,3);
$c = $a + 5;
var_dump($c);
echo "Done\n";
?>
+1
Ver Arquivo
@@ -0,0 +1 @@
HipHop Fatal error: Unsupported operand types in hphp/test/zend/bad/add_004.php on line %d
+11
Ver Arquivo
@@ -0,0 +1,11 @@
<?php
$a = array(1,2,3);
$s1 = "some string";
$c = $a + $s1;
var_dump($c);
echo "Done\n";
?>
+1
Ver Arquivo
@@ -0,0 +1 @@
HipHop Fatal error: Unsupported operand types in hphp/test/zend/bad/add_007.php on line %d
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<?php
trait T1 {
function m1() { echo "T:m1\n"; }
function m2() { echo "T:m2\n"; }
}
class C1 {
use T1 { m1 as a1; }
}
$o = new C1;
$o->m1();
$o->a1();
$o->m2();
$o->a2();
?>
+5
Ver Arquivo
@@ -0,0 +1,5 @@
T:m1
T:m1
T:m2
HipHop Fatal error: Call to undefined method C1::a2() in hphp/test/zend/bad/alias01.php on line %d
@@ -0,0 +1,11 @@
<?php
Class Base {
public function &test($foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
}
}
class Sub extends Base {
public function &test() {
}
}
?>
@@ -0,0 +1 @@
Strict Standards: Declaration of Sub::test() should be compatible with & Base::test($foo, array $bar, $option = NULL, $extra = 'llllllllll...') in %sargument_restriction_001.php on line %d
@@ -0,0 +1,11 @@
<?php
Abstract Class Base {
public function test($foo, array &$bar, $option = NULL, $extra = 3.141592653589793238462643383279502884197169399375105 ) {
}
}
class Sub extends Base {
public function test($foo, array &$bar) {
}
}
?>
@@ -0,0 +1 @@
Strict Standards: Declaration of Sub::test() should be compatible with Base::test($foo, array &$bar, $option = NULL, $extra = 3.1415926535898) in %sargument_restriction_002.php on line %d
@@ -0,0 +1,14 @@
<?php
class Foo {
}
Abstract Class Base {
public function test(Foo $foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
}
}
class Sub extends Base {
public function test() {
}
}
?>

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais