import all 5.5 tests

and spruce up the import script while I'm in there. Lots of new tests 'passed' because of the skipif

We are now at 45.4% pass rate
Esse commit está contido em:
Paul Tarjan
2013-07-23 23:13:23 -07:00
commit de Sara Golemon
commit b1d102c698
366 arquivos alterados com 1031 adições e 176 exclusões
+13
Ver Arquivo
@@ -0,0 +1,13 @@
<?php
setlocale(LC_ALL, 'Japanese_Japan.932');
/* timestamp has to be some wednesday */
$s = strftime('%A', 1372884126);
for ($i = 0; $i < strlen($s); $i++) {
printf("%x ", ord($s[$i]));
}
echo "\n";
echo strlen(strftime('%A')), "\n";
?>
===DONE===
@@ -0,0 +1,3 @@
90 85 97 6a 93 fa
6
===DONE===
@@ -50,4 +50,6 @@ $im_crop = imagecropauto($im, IMG_CROP_THRESHOLD, 0.1, 0x0);
imagepng($im_crop, __DIR__ . "/crop_threshold.png");
var_dump(imagesx($im_crop));
var_dump(imagesy($im_crop));
@unlink(__DIR__ . "/crop_threshold.png");
?>
+2 -2
Ver Arquivo
@@ -16,8 +16,8 @@ file_put_contents( $filename, 'The quick brown fox jumped over the lazy dog.' );
echo "\n-- Testing hash_file() function with an unknown algorithm --\n";
var_dump( hash_file( 'foobar', $filename ) );
echo "\n-- Testing hash_file() function with a non-existant file --\n";
var_dump( hash_file( 'md5', 'nonexistant.txt' ) );
echo "\n-- Testing hash_file() function with a non-existent file --\n";
var_dump( hash_file( 'md5', 'nonexistent.txt' ) );
echo "\n-- Testing hash_file() function with less than expected no. of arguments --\n";
var_dump( hash_file( 'md5' ) );
@@ -4,7 +4,7 @@
HipHop Warning: %s
bool(false)
-- Testing hash_file() function with a non-existant file --
-- Testing hash_file() function with a non-existent file --
HipHop Warning: %s
bool(false)
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
$haystack = 'Auf der Straße nach Paris habe ich mit dem Fahrer gesprochen';
var_dump(
grapheme_stripos($haystack, 'pariS '),
grapheme_stristr($haystack, 'paRis '),
grapheme_substr($haystack, grapheme_stripos($haystack, 'Paris'))
);
?>
@@ -0,0 +1,3 @@
int(20)
string(40) "Paris habe ich mit dem Fahrer gesprochen"
string(40) "Paris habe ich mit dem Fahrer gesprochen"
+10
Ver Arquivo
@@ -0,0 +1,10 @@
<?php
var_dump(substr('deja', 1, -4));
var_dump(substr('deja', -1, 0));
var_dump(grapheme_substr('deja', 1, -4));
var_dump(intl_get_error_message());
var_dump(grapheme_substr('deja', -1, 0));
var_dump(grapheme_substr('déjà', 1, -4));
var_dump(intl_get_error_message());
var_dump(grapheme_substr('déjà', -1, 0));
?>
@@ -0,0 +1,8 @@
bool(false)
string(0) ""
bool(false)
string(61) "grapheme_substr: invalid parameters: U_ILLEGAL_ARGUMENT_ERROR"
string(0) ""
bool(false)
string(65) "grapheme_substr: length is beyond start: U_ILLEGAL_ARGUMENT_ERROR"
string(0) ""
@@ -0,0 +1,13 @@
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump(
$intlcal->setMinimalDaysInFirstWeek(6),
$intlcal->getMinimalDaysInFirstWeek(),
intlcal_set_minimal_days_in_first_week($intlcal, 5),
$intlcal->getMinimalDaysInFirstWeek()
);
?>
==DONE==
@@ -0,0 +1,5 @@
bool(true)
int(6)
bool(true)
int(5)
==DONE==
@@ -1,7 +1,7 @@
<?php
ini_set("intl.error_level", E_WARNING);
Transliterator::create("inexistant id");
Transliterator::create("inexistent id");
echo intl_get_error_message(), "\n";
Transliterator::create("bad UTF-8 \x8F");
echo intl_get_error_message(), "\n";
@@ -1,5 +1,5 @@
HipHop Warning: %s
transliterator_create: unable to open ICU transliterator with id "inexistant id": U_INVALID_ID
transliterator_create: unable to open ICU transliterator with id "inexistent id": U_INVALID_ID
HipHop Warning: %s
String conversion of id to UTF-16 failed: U_INVALID_CHAR_FOUND
Done.
@@ -8,7 +8,7 @@ echo transliterator_transliterate("\x8F", $str), "\n";
echo intl_get_error_message(), "\n";
class A {
function __toString() { return "inexistant id"; }
function __toString() { return "inexistent id"; }
}
echo transliterator_transliterate(new A(), $str), "\n";
@@ -6,5 +6,5 @@ String conversion of id to UTF-16 failed: U_INVALID_CHAR_FOUND
HipHop Warning: %s
HipHop Warning: %s
transliterator_create: unable to open ICU transliterator with id "inexistant id": U_INVALID_ID
transliterator_create: unable to open ICU transliterator with id "inexistent id": U_INVALID_ID
Done.
@@ -34,4 +34,4 @@ foreach ($tests as $test)
var_dump(json_decode($test, true));
}
?>
?>
@@ -11,7 +11,7 @@ var_dump(ldap_get_values_len($link));
var_dump(ldap_get_values_len($link, $entry));
var_dump(ldap_get_values_len($link, $entry, "weirdAttribute", "Additional data"));
var_dump(ldap_get_values_len($link, $entry, "inexistantAttribute"));
var_dump(ldap_get_values_len($link, $entry, "inexistentAttribute"));
?>
===DONE===?>
<?php
@@ -17,6 +17,6 @@ function rebind_proc ($ds, $ldap_url) {
$link = ldap_connect($host, $port);
var_dump(ldap_set_rebind_proc($link));
var_dump(ldap_set_rebind_proc($link, "rebind_proc", "Additional data"));
var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistant"));
var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistent"));
?>
===DONE===
@@ -8,9 +8,9 @@ error_reporting(E_ALL&~E_NOTICE);
* Testing how preg_grep reacts to being passed bad regexes
*/
echo "*** Testing preg_grep() : error conditions ***\n";
$values = array('abcdef', //Regex without delimeter
'/[a-zA-Z]', //Regex without closing delimeter
'[a-zA-Z]/', //Regex without opening delimeter
$values = array('abcdef', //Regex without delimiter
'/[a-zA-Z]', //Regex without closing delimiter
'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
@@ -8,9 +8,9 @@ error_reporting(E_ALL&~E_NOTICE);
* Testing how preg_match_all reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_match_all() : error conditions ***\n";
$regex_array = array('abcdef', //Regex without delimeter
'/[a-zA-Z]', //Regex without closing delimeter
'[a-zA-Z]/', //Regex without opening delimeter
$regex_array = array('abcdef', //Regex without delimiter
'/[a-zA-Z]', //Regex without closing delimiter
'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
@@ -8,9 +8,9 @@ error_reporting(E_ALL&~E_NOTICE);
* Testing how preg_match reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_match() : error conditions ***\n";
$regex_array = array('abcdef', //Regex without delimeter
'/[a-zA-Z]', //Regex without closing delimeter
'[a-zA-Z]/', //Regex without opening delimeter
$regex_array = array('abcdef', //Regex without delimiter
'/[a-zA-Z]', //Regex without closing delimiter
'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
@@ -8,9 +8,9 @@ error_reporting(E_ALL&~E_NOTICE);
* Testing how preg_replace reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_replace() : error conditions***\n";
$regex_array = array('abcdef', //Regex without delimeter
'/[a-zA-Z]', //Regex without closing delimeter
'[a-zA-Z]/', //Regex without opening delimeter
$regex_array = array('abcdef', //Regex without delimiter
'/[a-zA-Z]', //Regex without closing delimiter
'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
@@ -8,10 +8,9 @@
ob_end_clean();
/* PDO Driver for MySQL, client library version => 6.0.3-alpha */
$expected = sprintf('Client API version => %s',
$db->getAttribute(PDO::ATTR_CLIENT_VERSION));
$reg = 'Client API version.*' . pcre_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/');
if (false === stristr($tmp, $expected)) {
if (!preg_match("/$reg/", $tmp)) {
printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n");
}
+17 -8
Ver Arquivo
@@ -43,15 +43,24 @@ $sql = "INSERT INTO ".$table_name." (num, bin) VALUES (-9999, CAST ('".$escaped_
pg_query($db, $sql);
// Retrieve binary from DB
$sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = -9999";
$result = pg_query($db, $sql);
$row = pg_fetch_array($result, 0, PGSQL_ASSOC);
for ($i = 0; $i < 2; $i++) {
$sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = -9999";
$result = pg_query($db, $sql);
$row = pg_fetch_array($result, 0, PGSQL_ASSOC);
if ($data === pg_unescape_bytea($row['bin'])) {
echo "pg_escape_bytea() actually works with database\n";
}
else {
echo "pg_escape_bytea() is broken\n";
if ($data === pg_unescape_bytea($row['bin'])) {
echo "pg_escape_bytea() actually works with database\n";
break;
}
elseif (!$i) {
// Force bytea escaping and retry
@pg_query($db, "SET bytea_output = 'escape'");
}
else {
$result = pg_query($db, $sql);
echo "pg_escape_bytea() is broken\n";
break;
}
}
// pg_escape_literal/pg_escape_identifier
@@ -0,0 +1,13 @@
<?php
error_reporting(E_ALL);
include 'config.inc';
$db = pg_connect($conn_str);
pg_query($db, "SET standard_conforming_strings = 0");
$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
$converted = pg_convert($db, $table_name, $fields);
var_dump($converted);
?>
@@ -0,0 +1,8 @@
array(3) {
["num"]=>
string(4) "1234"
["str"]=>
string(5) "'AAA'"
["bin"]=>
string(11) "'\\x424242'"
}
@@ -0,0 +1,15 @@
<?php
error_reporting(E_ALL);
include 'config.inc';
$db = pg_connect($conn_str);
pg_query($db, "SET standard_conforming_strings = 0");
$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
pg_insert($db, $table_name, $fields) or print "Error in test 1\n";
echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
echo "Ok\n";
?>
@@ -0,0 +1,2 @@
INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','\\x424242');
Ok
@@ -0,0 +1,17 @@
<?php
error_reporting(E_ALL);
include 'config.inc';
$db = pg_connect($conn_str);
pg_query("SET bytea_output = 'hex'");
$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
$ids = array('num'=>'1234');
$res = pg_select($db, $table_name, $ids) or print "Error\n";
var_dump($res);
echo pg_select($db, $table_name, $ids, PGSQL_DML_STRING)."\n";
echo "Ok\n";
?>
@@ -0,0 +1,13 @@
array(1) {
[0]=>
array(3) {
["num"]=>
string(4) "1234"
["str"]=>
string(3) "AAA"
["bin"]=>
string(8) "\x424242"
}
}
SELECT * FROM php_pgsql_test WHERE num=1234;
Ok
@@ -0,0 +1,16 @@
<?php
error_reporting(E_ALL);
include 'config.inc';
$db = pg_connect($conn_str);
pg_query($db, "SET standard_conforming_strings = 0");
$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ');
$ids = array('num'=>'1234');
pg_update($db, $table_name, $fields, $ids) or print "Error in test 1\n";
echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n";
echo "Ok\n";
?>
@@ -0,0 +1,2 @@
UPDATE php_pgsql_test SET num=1234,str='ABC',bin='\\x58595a' WHERE num=1234;
Ok
@@ -0,0 +1,23 @@
<?php
// optional functions
include('config.inc');
$image = file_get_contents(dirname(__FILE__) . '/php.gif');
$esc_image = pg_escape_bytea($image);
$db = pg_connect($conn_str);
@pg_query($db, "SET bytea_output = 'escape'");
pg_query($db, 'INSERT INTO '.$table_name.' (num, bin) VALUES (9876, E\''.$esc_image.'\');');
$result = pg_query($db, 'SELECT * FROM '.$table_name.' WHERE num = 9876');
$rows = pg_fetch_all($result);
$unesc_image = pg_unescape_bytea($rows[0]['bin']);
if ($unesc_image !== $image) {
echo "NG";
}
else {
echo "OK";
}
?>
@@ -0,0 +1 @@
OK
@@ -0,0 +1,23 @@
<?php
// optional functions
include('config.inc');
$db = pg_connect($conn_str);
@pg_query($db, "SET bytea_output = 'escape'");
$image = file_get_contents(dirname(__FILE__) . '/php.gif');
$esc_image = pg_escape_bytea($image);
pg_query($db, 'INSERT INTO '.$table_name.' (num, bin) VALUES (9876, \''.$esc_image.'\');');
$result = pg_query($db, 'SELECT * FROM '.$table_name.' WHERE num = 9876');
$rows = pg_fetch_all($result);
$unesc_image = pg_unescape_bytea($rows[0]['bin']);
if ($unesc_image !== $image) {
echo "NG";
}
else {
echo "OK";
}
?>
@@ -0,0 +1 @@
OK
@@ -0,0 +1,23 @@
<?php
// optional functions
include('config.inc');
$db = pg_connect($conn_str);
@pg_query($db, "SET bytea_output = 'hex'");
$image = file_get_contents(dirname(__FILE__) . '/php.gif');
$esc_image = pg_escape_bytea($image);
pg_query($db, 'INSERT INTO '.$table_name.' (num, bin) VALUES (9876, \''.$esc_image.'\');');
$result = pg_query($db, 'SELECT * FROM '.$table_name.' WHERE num = 9876');
$rows = pg_fetch_all($result);
$unesc_image = pg_unescape_bytea($rows[0]['bin']);
if ($unesc_image !== $image) {
echo "NG";
}
else {
echo "OK";
}
?>
@@ -0,0 +1 @@
OK
@@ -30,6 +30,8 @@ array_walk($trace, 'search_trace_file');
var_dump($found > 0);
var_dump(file_exists($tracefile));
@unlink($tracefile);
?>
===DONE===?>
<?php unlink($tracefile); ?>
+1
Ver Arquivo
@@ -3,6 +3,7 @@
include 'config.inc';
$db = pg_connect($conn_str);
@pg_query("SET bytea_output = 'escape'");
@pg_query('DROP TABLE test_bug');
+33
Ver Arquivo
@@ -0,0 +1,33 @@
<?php
include 'config.inc';
$db = pg_connect($conn_str);
@pg_query('DROP TABLE test_bug');
pg_query('CREATE TABLE test_bug (binfield byteA) ;');
pg_query("INSERT INTO test_bug VALUES (decode('0103AA000812','hex'))");
$data = pg_query("SELECT binfield FROM test_bug");
$res = pg_fetch_result($data,0);
var_dump($res);
var_dump(bin2hex(pg_unescape_bytea($res)));
$sql = "BEGIN; DECLARE mycursor BINARY CURSOR FOR SELECT binfield FROM test_bug; FETCH ALL IN mycursor;";
$data = pg_query($sql);
$res = pg_fetch_result($data,0);
var_dump(strlen($res));
var_dump(bin2hex($res));
pg_close($db);
$db = pg_connect($conn_str);
pg_query('DROP TABLE test_bug');
pg_close($db);
?>
@@ -0,0 +1,4 @@
string(14) "\x0103aa000812"
string(12) "0103aa000812"
int(6)
string(12) "0103aa000812"
@@ -0,0 +1,27 @@
<?php
include __DIR__."/mcast_helpers.php.inc";
$path = "\x00/foo_bar";
echo "creating server socket\n";
$servers = socket_create(AF_UNIX, SOCK_STREAM, 0) or die("err");
socket_bind($servers, $path) or die("Could not bind");
socket_listen($servers) or die("Could not listen");
socket_set_nonblock($servers) or die("Could not put in non-blocking mode");
echo "creating client socket\n";
$clients = socket_create(AF_UNIX, SOCK_STREAM, 0) or die("err");
socket_connect($clients, $path) or die("Error connecting");
$conns = socket_accept($servers) or die("Could not accept connection");
$r = socket_sendmsg($clients, [
//"name" => [ "addr" => $path, ],
"iov" => ["test ", "thing", "\n"],
], 0);
var_dump($r);
checktimeout($conns, 500);
if (!socket_recv($conns, $buf, 20, 0)) die("recv");
print_r($buf);
?>
@@ -0,0 +1,4 @@
creating server socket
creating client socket
int(11)
test thing
@@ -0,0 +1,23 @@
<?php
include __DIR__."/mcast_helpers.php.inc";
$path = "\x00/bar_foo";
echo "creating send socket\n";
$sends1 = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err");
socket_set_nonblock($sends1) or die("Could not put in non-blocking mode");
echo "creating receive socket\n";
$s = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err");
socket_bind($s, $path) or die("err");
$r = socket_sendmsg($sends1, [
"name" => [ "path" => $path],
"iov" => ["test ", "thing", "\n"],
], 0);
var_dump($r);
checktimeout($s, 500);
if (!socket_recv($s, $buf, 20, 0)) die("recv");
print_r($buf);
?>
@@ -0,0 +1,4 @@
creating send socket
creating receive socket
int(11)
test thing
@@ -27,6 +27,7 @@ Array
[0] => Resource id #%d
[1] => Resource id #%d
[2] => Resource id #%d
[3] => Resource id #%d
)
)
@@ -0,0 +1,14 @@
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!$socket) {
die('Unable to create AF_INET socket [socket]');
}
// wrong params
$retval_1 = socket_set_option( $socket, SOL_SOCKET, SO_BINDTODEVICE, "lo");
var_dump($retval_1);
$retval_2 = socket_set_option( $socket, SOL_SOCKET, SO_BINDTODEVICE, "ethIDONOTEXIST");
var_dump($retval_2);
socket_close($socket);
?>
@@ -0,0 +1,3 @@
bool(true)
HipHop Warning: %s
bool(false)
@@ -6,5 +6,8 @@ $fo = new SplFileObject('SplFileObject_rewind_error001.csv');
$fo->rewind( "invalid" );
unlink('SplFileObject_rewind_error001.csv');
?><?php
unlink('SplFileObject_rewind_error001.csv');
unlink('SplFileObject_rewind_error001.csv');
?>
@@ -1,57 +0,0 @@
<?php
class MyIterator extends ArrayIterator {
function __construct() {
$args = func_get_args();
echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
}
function rewind() {
$args = func_get_args();
echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
return parent::rewind();
}
function valid() {
$args = func_get_args();
echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
return parent::valid();
}
function current() {
$args = func_get_args();
echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
return parent::current();
}
function next() {
$args = func_get_args();
echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
return parent::next();
}
function key() {
$args = func_get_args();
echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
return parent::key();
}
}
$ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "MyIterator");
echo "--> Access using MyIterator:\n";
var_dump($ao->getIteratorClass());
var_dump($ao->getIterator());
foreach($ao as $key=>$value) {
echo " $key=>$value\n";
}
echo "\n\n--> Access using ArrayIterator:\n";
var_dump($ao->setIteratorClass("ArrayIterator"));
var_dump($ao->getIteratorClass());
var_dump($ao->getIterator());
foreach($ao as $key=>$value) {
echo "$key=>$value\n";
}
?>
+5
Ver Arquivo
@@ -0,0 +1,5 @@
<?php
$x = new DirectoryIterator('.');
$x->__construct('/tmp');
echo "Okey";
?>
@@ -0,0 +1,2 @@
HipHop Warning: %s
Okey
@@ -0,0 +1,52 @@
<?php
$arr = array(
0 => array(
"a",
1,
),
"a" => array(
2,
"b",
3 => array(
4,
"c",
),
"3" => array(
4,
"c",
),
),
);
$it = new RecursiveArrayIterator($arr);
$it = new RecursiveTreeIterator($it);
echo "----\n";
echo $it->getPostfix();
echo "\n\n";
echo "----\n";
$it->setPostfix("POSTFIX");
echo $it->getPostfix();
echo "\n\n";
echo "----\n";
foreach($it as $k => $v) {
echo "[$k] => $v\n";
}
echo "----\n";
$it->setPostfix("");
echo $it->getPostfix();
echo "\n\n";
echo "----\n";
foreach($it as $k => $v) {
echo "[$k] => $v\n";
}
?>
===DONE===
@@ -0,0 +1,30 @@
----
----
POSTFIX
----
[0] => |-ArrayPOSTFIX
[0] => | |-aPOSTFIX
[1] => | \-1POSTFIX
[a] => \-ArrayPOSTFIX
[0] => |-2POSTFIX
[1] => |-bPOSTFIX
[3] => \-ArrayPOSTFIX
[0] => |-4POSTFIX
[1] => \-cPOSTFIX
----
----
[0] => |-Array
[0] => | |-a
[1] => | \-1
[a] => \-Array
[0] => |-2
[1] => |-b
[3] => \-Array
[0] => |-4
[1] => \-c
===DONE===
@@ -0,0 +1,92 @@
<?php
var_dump(array_walk());
$ar = false;
var_dump(array_walk($ar, $ar));
$ar = NULL;
var_dump(array_walk($ar, $ar));
$ar = ["one" => 1, "two"=>2, "three" => 3];
var_dump(array_walk($ar, function(){ var_dump(func_get_args());}));
echo "\nclosure with array\n";
$ar = ["one" => 1, "two"=>2, "three" => 3];
$user_data = ["sum" => 42];
$func = function($value, $key, &$udata) {
var_dump($udata);
$udata["sum"] += $value;
};
var_dump(array_walk($ar, $func, $user_data));
echo "End result:";
var_dump($user_data["sum"]);
echo "\nclosure with use\n";
$ar = ["one" => 1, "two"=>2, "three" => 3];
$user_data = ["sum" => 42];
$func = function($value, $key) use (&$user_data) {
var_dump($user_data);
$user_data["sum"] += $value;
};
var_dump(array_walk($ar, $func, $user_data));
echo "End result:";
var_dump($user_data["sum"]);
echo "\nclosure with object\n";
$ar = ["one" => 1, "two"=>2, "three" => 3];
$user_data = (object)["sum" => 42];
$func = function($value, $key, &$udata) {
var_dump($udata);
$udata->sum += $value;
};
var_dump(array_walk($ar, $func, $user_data));
echo "End result:";
var_dump($user_data->sum);
echo "\nfunction with object\n";
function sum_it_up_object($value, $key, $udata)
{
var_dump($udata);
$udata->sum += $value;
}
$ar = ["one" => 1, "two"=>2, "three" => 3];
$user_data = (object)["sum" => 42];
var_dump(array_walk($ar, "sum_it_up_object", $user_data));
echo "End result:";
var_dump($user_data->sum);
echo "\nfunction with array\n";
function sum_it_up_array($value, $key, $udata)
{
var_dump($udata);
$udata['sum'] += $value;
}
$ar = ["one" => 1, "two"=>2, "three" => 3];
$user_data = ["sum" => 42];
var_dump(array_walk($ar, "sum_it_up_array", $user_data));
echo "End result:";
var_dump($user_data['sum']);
echo "\nclosure and exception\n";
$ar = ["one" => 1, "two"=>2, "three" => 3];
try {
var_dump(array_walk($ar, function($v, $k) { if ($v == 2) throw new Exception; } ));
} catch (Exception $e) {
var_dump($e->getTrace());
}
echo "Done\n";
?>
@@ -0,0 +1,153 @@
HipHop Warning: %s
NULL
HipHop Warning: %s
NULL
HipHop Warning: %s
NULL
array(2) {
[0]=>
int(1)
[1]=>
string(3) "one"
}
array(2) {
[0]=>
int(2)
[1]=>
string(3) "two"
}
array(2) {
[0]=>
int(3)
[1]=>
string(5) "three"
}
bool(true)
closure with array
array(1) {
["sum"]=>
int(42)
}
array(1) {
["sum"]=>
int(43)
}
array(1) {
["sum"]=>
int(45)
}
bool(true)
End result:int(42)
closure with use
array(1) {
["sum"]=>
int(42)
}
array(1) {
["sum"]=>
int(43)
}
array(1) {
["sum"]=>
int(45)
}
bool(true)
End result:int(48)
closure with object
object(stdClass)#1 (1) {
["sum"]=>
int(42)
}
object(stdClass)#1 (1) {
["sum"]=>
int(43)
}
object(stdClass)#1 (1) {
["sum"]=>
int(45)
}
bool(true)
End result:int(48)
function with object
object(stdClass)#2 (1) {
["sum"]=>
int(42)
}
object(stdClass)#2 (1) {
["sum"]=>
int(43)
}
object(stdClass)#2 (1) {
["sum"]=>
int(45)
}
bool(true)
End result:int(48)
function with array
array(1) {
["sum"]=>
int(42)
}
array(1) {
["sum"]=>
int(42)
}
array(1) {
["sum"]=>
int(42)
}
bool(true)
End result:int(42)
closure and exception
array(2) {
[0]=>
array(2) {
["function"]=>
string(9) "{closure}"
["args"]=>
array(2) {
[0]=>
int(2)
[1]=>
string(3) "two"
}
}
[1]=>
array(4) {
["file"]=>
string(%d) "%s"
["line"]=>
int(%d)
["function"]=>
string(10) "array_walk"
["args"]=>
array(2) {
[0]=>
&array(3) {
["one"]=>
int(1)
["two"]=>
int(2)
["three"]=>
int(3)
}
[1]=>
object(Closure)#2 (1) {
["parameter"]=>
array(2) {
["$v"]=>
string(10) "<required>"
["$k"]=>
string(10) "<required>"
}
}
}
}
}
Done
@@ -0,0 +1,4 @@
<?php
var_dump(array_sum(array(PHP_INT_MAX, 1)));
var_dump(PHP_INT_MAX + 1);
?>
@@ -0,0 +1,2 @@
float(%s)
float(%s)
@@ -5,7 +5,7 @@
*
/*
* This testcase tests uasort() functionality with differnt objects
* This testcase tests uasort() functionality with different objects
* Objects of different classes:
* simple class,
* child class,
@@ -1,5 +1,5 @@
<?php
$result = exec('cd 1:\non_existant; dir nonexistant');
$result = exec('cd 1:\non_existent; dir nonexistent');
echo "$result";
system('cd 1:\non_existant; dir nonexistant');
system('cd 1:\non_existent; dir nonexistent');
?>
@@ -1,4 +1,4 @@
<?php
$result = exec('cd 1:\\non_existant; dir nonexistant');
$result = exec('cd 1:\\non_existent; dir nonexistent');
echo "$result";
?>
@@ -1,3 +1,3 @@
<?php
system('cd 1:\\non_existant; dir nonexistant');
system('cd 1:\\non_existent; dir nonexistent');
?>
@@ -19,7 +19,7 @@ var_dump( lchown( $filename ) );
// More than expected arguments
var_dump( lchown( $filename, $uid, 'foobar' ) );
// Non-existant filename
// Non-existent filename
var_dump( lchown( 'foobar_lchown.txt', $uid ) );
// Wrong argument types
@@ -10,8 +10,8 @@ symlink(basename($prefix . "_file"), $prefix . "_link1");
symlink(basename($prefix . "_link1"), $prefix . "_link2");
// symlink to a non-existent path
@unlink($prefix . "_nonexistant");
symlink(basename($prefix . "_nonexistant"), $prefix . "_link3");
@unlink($prefix . "_nonexistent");
symlink(basename($prefix . "_nonexistent"), $prefix . "_link3");
// symlink to a regular file using an absolute path
symlink($prefix . "_file", $prefix . "_link4");
@@ -1,5 +1,5 @@
%unicode|string%(%d) "symlink_to_symlink.php_file"
%unicode|string%(%d) "symlink_to_symlink.php_link1"
%unicode|string%(%d) "symlink_to_symlink.php_nonexistant"
%unicode|string%(%d) "symlink_to_symlink.php_nonexistent"
%unicode|string%(%d) "%s/symlink_to_symlink.php_file"
%unicode|string%(%d) "%s/symlink_to_symlink.php_link4"
@@ -155,7 +155,7 @@ class mystream
}
if (@stream_wrapper_register("bogus", "class_not_exist")) {
die("Registered a non-existant class!!!???");
die("Registered a non-existent class!!!???");
}
echo "Not Registered\n";
@@ -21,8 +21,8 @@ class sample {
//getting the resource
$file_handle = fopen(__FILE__, "r");
// array with different values for $delimeter
$delimeters = array (
// array with different values for $delimiter
$delimiters = array (
// integer values
0,
@@ -65,13 +65,13 @@ $delimeters = array (
@$unset_var
);
// loop through with each element of the $delimeters array to test explode() function
// loop through with each element of the $delimiters array to test explode() function
$count = 1;
$string = "piece1 piece2 piece3 piece4 piece5 piece6";
$limit = 5;
foreach($delimeters as $delimeter) {
foreach($delimiters as $delimiter) {
echo "-- Iteration $count --\n";
var_dump( explode($delimeter, $string, $limit) );
var_dump( explode($delimiter, $string, $limit) );
$count ++;
}
@@ -0,0 +1,24 @@
<?php
/* Prototype : int ip2long(string ip_address)
* Description: Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address
* Source code: ext/standard/basic_functions.c
* Alias to functions:
*/
$ips = array(
"1.1.011.011",
"127.0.0.1",
"1.1.071.071",
"0.0.0.0",
"1.1.081.081",
"192.168.0.0",
"256.0.0.1",
"192.168.0xa.5",
);
foreach($ips as $ip) {
var_dump(ip2long($ip));
}
?>
===DONE===
@@ -0,0 +1,9 @@
bool(false)
int(2130706433)
bool(false)
int(0)
bool(false)
int(-1062731776)
bool(false)
bool(false)
===DONE===
@@ -0,0 +1,24 @@
<?php
/* Prototype : int ip2long(string ip_address)
* Description: Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address
* Source code: ext/standard/basic_functions.c
* Alias to functions:
*/
$ips = array(
"1.1.011.011",
"127.0.0.1",
"1.1.071.071",
"0.0.0.0",
"1.1.081.081",
"192.168.0.0",
"256.0.0.1",
"192.168.0xa.5",
);
foreach($ips as $ip) {
var_dump(ip2long($ip));
}
?>
===DONE===
@@ -0,0 +1,9 @@
bool(false)
int(2130706433)
bool(false)
int(0)
bool(false)
int(3232235520)
bool(false)
bool(false)
===DONE===
@@ -21,8 +21,8 @@ class sample {
//getting the resource
$file_handle = fopen(__FILE__, "r");
// array with different values for $delimeter
$delimeters = array (
// array with different values for $delimiter
$delimiters = array (
// integer values
/*1*/ 0,
@@ -65,13 +65,13 @@ $delimeters = array (
/*22*/ @$unset_var
);
// loop through with each element of the $delimeters array to test explode() function
// loop through with each element of the $delimiters array to test explode() function
$count = 1;
$string = "piece1 piece2 piece3 piece4 piece5 piece6";
$limit = 5;
foreach($delimeters as $delimeter) {
foreach($delimiters as $delimiter) {
echo "-- Iteration $count --\n";
var_dump( explode($delimeter, $string, $limit) );
var_dump( explode($delimiter, $string, $limit) );
$count ++;
}
@@ -67,11 +67,11 @@ $strings = array (
// loop through with each element of the $strings array to test explode() function
$count = 1;
$delimeter = " ";
$delimiter = " ";
$limit = 5;
foreach($strings as $string) {
echo "-- Iteration $count --\n";
var_dump( explode($delimeter, $string, $limit) );
var_dump( explode($delimiter, $string, $limit) );
$count ++;
}
@@ -21,7 +21,7 @@ class sample {
//getting the resource
$file_handle = fopen(__FILE__, "r");
// array with different values for $delimeter
// array with different values for $delimiter
$limits = array (
// integer values
@@ -67,11 +67,11 @@ $limits = array (
// loop through with each element of the $limits array to test explode() function
$count = 1;
$delimeter = " ";
$delimiter = " ";
$string = "piece1 piece2 piece3 piece4 piece5 piece6";
foreach($limits as $limit) {
echo "-- Iteration $count --\n";
var_dump( explode($delimeter, $string, $limit) );
var_dump( explode($delimiter, $string, $limit) );
$count ++;
}
@@ -88,7 +88,7 @@ $file_handle = fopen(__FILE__, "r");
/* directory type resource */
$dir_handle = opendir( dirname(__FILE__) );
/* store resources in array for comparision */
/* store resources in array for comparison */
$resources = array($file_handle, $dir_handle);
var_dump( implode("::", $resources) );
@@ -31,6 +31,6 @@ var_dump( strrchr("Hello, World", "Hi") );
var_dump( strrchr("Hello, World", "o") );
var_dump( strrchr("Hello, World", "ooo") );
var_dump( strrchr("Hello, World", "Zzzz") ); //non-existant needle in haystack
var_dump( strrchr("Hello, World", "Zzzz") ); //non-existent needle in haystack
echo "*** Done ***";
?>
@@ -23,7 +23,7 @@ echo "\n-- Testing substr_replace() function with start and length different typ
var_dump(substr_replace($s1, "evening", array(5)));
var_dump(substr_replace($s1, "evening", 5, array(8)));
echo "\n-- Testing substr_replace() function with start and length with a different number of elments --\n";
echo "\n-- Testing substr_replace() function with start and length with a different number of elements --\n";
var_dump(substr_replace($s1, "evening", array(5, 1), array(8)));
echo "\n-- Testing substr_replace() function with start and length as arrays but string not--\n";
@@ -16,7 +16,7 @@ string(12) "Good morning"
HipHop Warning: %s
string(12) "Good morning"
-- Testing substr_replace() function with start and length with a different number of elments --
-- Testing substr_replace() function with start and length with a different number of elements --
HipHop Warning: %s
string(12) "Good morning"
@@ -1,4 +1,3 @@
--> 64.246.30.37: array(1) {
["path"]=>
string(12) "64.246.30.37"
@@ -720,13 +719,6 @@
string(1) ":"
}
--> http://::#: array(2) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) ":"
}
--> x://::6.5: array(3) {
["scheme"]=>
string(1) "x"
@@ -840,8 +832,6 @@
--> http://?: bool(false)
--> http://#: bool(false)
--> http://?:: bool(false)
--> http://:?: bool(false)
@@ -0,0 +1,6 @@
<?php
parse_str("foo=BAR", $_POST);
$_REQUEST = array_merge($_REQUEST, $_POST);
echo php_sapi_name();
?>
+5
Ver Arquivo
@@ -0,0 +1,5 @@
<?php
xml_parse_into_struct(xml_parser_create_ns(), str_repeat("<blah>", 1000), $a);
echo "Done\n";
?>
@@ -0,0 +1,2 @@
HipHop Warning: %s
Done
@@ -0,0 +1,18 @@
<?php
class foo
{
private $private = 'private';
protected $protected = 'protected';
public $public = 'public';
}
class bar extends foo
{
public function __sleep()
{
return array("\0foo\0private", 'protected', 'public');
}
}
var_dump(str_replace("\0", '\0', serialize(new bar())));
?>
@@ -0,0 +1 @@
string(114) "O:3:"bar":3:{s:12:"\0foo\0private";s:7:"private";s:12:"\0*\0protected";s:9:"protected";s:6:"public";s:6:"public";}"
@@ -0,0 +1,15 @@
<?php
function gen() {
fn();
yield;
}
function fn() {
exit('Done');
}
$gen = gen();
$gen->current();
?>
@@ -0,0 +1 @@
Done
+20
Ver Arquivo
@@ -0,0 +1,20 @@
<?php
trait TestTrait
{
public static function testStaticFunction()
{
return __CLASS__;
}
}
class Tester
{
use TestTrait;
}
$foo = Tester::testStaticFunction();
get_defined_constants();
get_defined_constants(true);
echo $foo;
?>
@@ -0,0 +1 @@
Tester
+1 -1
Ver Arquivo
@@ -1,6 +1,6 @@
<?php
/* A non-static closure has a bound instance if it has a scope
* and does't have an instance if it has no scope */
* and doesn't have an instance if it has no scope */
$nonstaticUnscoped = function () { var_dump(isset(A::$priv)); var_dump(isset($this)); };

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