import zend spl tests
Lots of these tests spewed files
Esse commit está contido em:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
function spl_examples_autoload($classname)
|
||||
{
|
||||
include(dirname(__FILE__) . '/../' . strtolower($classname) . '.inc');
|
||||
}
|
||||
|
||||
spl_autoload_register('spl_examples_autoload');
|
||||
|
||||
function test($a, $b, $identical = false)
|
||||
{
|
||||
var_dump(DualIterator::compareIterators(
|
||||
new RecursiveArrayIterator($a),
|
||||
new RecursiveArrayIterator($b),
|
||||
$identical));
|
||||
}
|
||||
|
||||
test(array(1,2,3), array(1,2,3));
|
||||
test(array(1,2,3), array(1,2));
|
||||
test(array(1,array(21,22),3), array(1,array(21,22),3));
|
||||
test(array(1,array(21,22),3), array(1,array(21,22,23),3));
|
||||
test(array(1,array(21,22),3), array(1,array(21,22,3)));
|
||||
test(array(1,array(21,22),3), array(1,array(21),array(22),3));
|
||||
test(array(1,2,3), array(1,"2",3), false);
|
||||
test(array(1,2,3), array(1,"2",3), true);
|
||||
test(array(1,array(21,22),3), array(1,array(21,"22"),3), false);
|
||||
test(array(1,array(21,22),3), array(1,array(21,"22"),3), true);
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
@@ -0,0 +1,11 @@
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$a = new ArrayObject(array());
|
||||
$a->unserialize("");
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
HipHop Fatal error: %a
|
||||
Stack trace:
|
||||
#0 %s(%d): ArrayObject->unserialize('')
|
||||
#1 {main}
|
||||
thrown in %s.php on line %d
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
set_error_handler(function($errno, $errstr){
|
||||
echo $errstr . "\n";
|
||||
return true;
|
||||
});
|
||||
|
||||
try {
|
||||
new CallbackFilterIterator();
|
||||
} catch(InvalidArgumentException $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
new CallbackFilterIterator(null);
|
||||
} catch(InvalidArgumentException $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
new CallbackFilterIterator(new ArrayIterator(array()), null);
|
||||
} catch(InvalidArgumentException $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
try {
|
||||
new CallbackFilterIterator(new ArrayIterator(array()), array());
|
||||
} catch(InvalidArgumentException $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
$it = new CallbackFilterIterator(new ArrayIterator(array(1)), function() {
|
||||
throw new Exception("some message");
|
||||
});
|
||||
try {
|
||||
foreach($it as $e);
|
||||
} catch(Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
CallbackFilterIterator::__construct() expects exactly 2 parameters, 0 given
|
||||
Argument 1 passed to CallbackFilterIterator::__construct() must implement interface Iterator, null given
|
||||
CallbackFilterIterator::__construct() expects exactly 2 parameters, 1 given
|
||||
CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, no array or string given
|
||||
CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, array must have exactly two members
|
||||
some message
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function test($value, $key, $inner) {
|
||||
return test($value, $key, $inner);
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
static function test($value, $key, $inner) {
|
||||
return test($value, $key, $inner);
|
||||
}
|
||||
}
|
||||
|
||||
function test($value, $key, $inner) {
|
||||
printf("%s / %s / %d / %d\n"
|
||||
, $value
|
||||
, $key
|
||||
, $value == $inner->current()
|
||||
, $key == $inner->key()
|
||||
);
|
||||
return $value === 1 || $value === 4;
|
||||
}
|
||||
|
||||
$tests = array(
|
||||
'instance method' => function() { return array(new A, 'test'); },
|
||||
'static method' => function() { return array('B', 'test'); },
|
||||
'static method (2)' => function() { return 'B::test'; },
|
||||
'function' => function() { return 'test'; },
|
||||
'anonymous function' => function() { return function($value, $key, $inner) { return test($value, $key, $inner); }; },
|
||||
);
|
||||
|
||||
foreach($tests as $name => $test) {
|
||||
|
||||
$callback = $test();
|
||||
$it = new ArrayIterator(range(1, 5));
|
||||
$it = new CallbackFilterIterator($it, $callback);
|
||||
|
||||
echo " = $name =\n";
|
||||
|
||||
foreach($it as $value) {
|
||||
echo "=> $value\n";
|
||||
}
|
||||
|
||||
// same test, with no reference to callback
|
||||
|
||||
$it = new ArrayIterator(range(1, 5));
|
||||
$it = new CallbackFilterIterator($it, $test());
|
||||
unset($callback);
|
||||
|
||||
foreach($it as $value) {
|
||||
echo "=> $value\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
= instance method =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
= static method =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
= static method (2) =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
= function =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
= anonymous function =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 1 / 1 / 1
|
||||
3 / 2 / 1 / 1
|
||||
4 / 3 / 1 / 1
|
||||
=> 4
|
||||
5 / 4 / 1 / 1
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$it = new DirectoryIterator("");
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
HipHop Fatal error: %a
|
||||
Stack trace:
|
||||
#0 %s(%d): DirectoryIterator->__construct('')
|
||||
#1 {main}
|
||||
thrown in hphp/test/zend/bad/ext-spl/DirectoryIterator_empty_constructor.php on line %d
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
|
||||
mkdir($targetDir);
|
||||
touch($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
|
||||
$dir = new DirectoryIterator($targetDir.DIRECTORY_SEPARATOR);
|
||||
while(!$dir->isFile()) {
|
||||
$dir->next();
|
||||
}
|
||||
echo $dir->getBasename(array());
|
||||
?><?php
|
||||
$targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
|
||||
unlink($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
|
||||
rmdir($targetDir);
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
$dir = __DIR__ . DIRECTORY_SEPARATOR . md5('DirectoryIterator::getExtension') . DIRECTORY_SEPARATOR;
|
||||
mkdir($dir);
|
||||
|
||||
$files = array('test.txt', 'test.extension', 'test..', 'test.', 'test');
|
||||
foreach ($files as $file) {
|
||||
touch($dir . $file);
|
||||
}
|
||||
|
||||
$dit_exts = array();
|
||||
$nfo_exts = array();
|
||||
$skip = array('.', '..');
|
||||
|
||||
foreach (new DirectoryIterator($dir) as $file) {
|
||||
if (in_array($file->getFilename(), $skip)) {
|
||||
continue;
|
||||
}
|
||||
$dit_exts[] = $file->getExtension();
|
||||
$nfo_exts[] = pathinfo($file->getFilename(), PATHINFO_EXTENSION);
|
||||
}
|
||||
var_dump($dit_exts === $nfo_exts);
|
||||
sort($dit_exts);
|
||||
var_dump($dit_exts);
|
||||
?><?php
|
||||
$dir = __DIR__ . DIRECTORY_SEPARATOR . md5('DirectoryIterator::getExtension') . DIRECTORY_SEPARATOR;
|
||||
$files = array('test.txt', 'test.extension', 'test..', 'test.', 'test');
|
||||
foreach ($files as $file) {
|
||||
unlink($dir . $file);
|
||||
}
|
||||
rmdir($dir);
|
||||
?>
|
||||
@@ -0,0 +1,13 @@
|
||||
bool(true)
|
||||
array(5) {
|
||||
[0]=>
|
||||
string(0) ""
|
||||
[1]=>
|
||||
string(0) ""
|
||||
[2]=>
|
||||
string(0) ""
|
||||
[3]=>
|
||||
string(9) "extension"
|
||||
[4]=>
|
||||
string(3) "txt"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
//file
|
||||
$fileInfo = new SplFileInfo('not_existing');
|
||||
var_dump($fileInfo->getInode());
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
HipHop Fatal error: %a
|
||||
Stack trace:
|
||||
#0 %s: SplFileInfo->getInode()
|
||||
#1 {main}
|
||||
thrown in %s
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function test($value, $key, $inner) {
|
||||
return test($value, $key, $inner);
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
static function test($value, $key, $inner) {
|
||||
return test($value, $key, $inner);
|
||||
}
|
||||
}
|
||||
|
||||
function test($value, $key, $inner) {
|
||||
if ($inner->hasChildren()) {
|
||||
return true;
|
||||
}
|
||||
printf("%s / %s / %d / %d\n"
|
||||
, print_r($value, true)
|
||||
, $key
|
||||
, $value == $inner->current()
|
||||
, $key == $inner->key()
|
||||
);
|
||||
return $value === 1 || $value === 4;
|
||||
}
|
||||
|
||||
$tests = array(
|
||||
'instance method' => function() { return array(new A, 'test'); },
|
||||
'static method' => function() { return array('B', 'test'); },
|
||||
'static method (2)' => function() { return 'B::test'; },
|
||||
'function' => function() { return 'test'; },
|
||||
'anonymous function' => function() { return function($value, $key, $inner) { return test($value, $key, $inner); }; },
|
||||
);
|
||||
|
||||
foreach($tests as $name => $test) {
|
||||
|
||||
$callback = $test();
|
||||
$it = new RecursiveArrayIterator(array(1, array(2, 3), array(4, 5)));
|
||||
$it = new RecursiveCallbackFilterIterator($it, $callback);
|
||||
$it = new RecursiveIteratorIterator($it);
|
||||
|
||||
echo " = $name =\n";
|
||||
|
||||
foreach($it as $value) {
|
||||
echo "=> $value\n";
|
||||
}
|
||||
|
||||
// same test, with no reference to callback
|
||||
|
||||
$it = new RecursiveArrayIterator(array(1, array(2, 3), array(4, 5)));
|
||||
$it = new RecursiveCallbackFilterIterator($it, $test());
|
||||
$it = new RecursiveIteratorIterator($it);
|
||||
unset($callback);
|
||||
|
||||
foreach($it as $value) {
|
||||
echo "=> $value\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
= instance method =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
= static method =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
= static method (2) =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
= function =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
= anonymous function =
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
1 / 0 / 1 / 1
|
||||
=> 1
|
||||
2 / 0 / 1 / 1
|
||||
3 / 1 / 1 / 1
|
||||
4 / 0 / 1 / 1
|
||||
=> 4
|
||||
5 / 1 / 1 / 1
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
$depth0 = "depth0";
|
||||
$depth1 = 'depth1';
|
||||
$depth2 = 'depth2';
|
||||
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
|
||||
mkdir($targetDir, 0777, true);
|
||||
touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPath_test.tmp');
|
||||
$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0);
|
||||
$it = new RecursiveIteratorIterator($iterator);
|
||||
|
||||
$list = [];
|
||||
while($it->valid()) {
|
||||
$list[] = $it->getSubPath();
|
||||
$it->next();
|
||||
}
|
||||
asort($list);
|
||||
foreach ($list as $item) {
|
||||
echo $item . "\n";
|
||||
}
|
||||
?><?php
|
||||
function rrmdir($dir) {
|
||||
foreach(glob($dir . '/*') as $file) {
|
||||
if(is_dir($file)) {
|
||||
rrmdir($file);
|
||||
} else {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
$targetDir = __DIR__.DIRECTORY_SEPARATOR . "depth0";
|
||||
rrmdir($targetDir);
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
depth1
|
||||
depth1
|
||||
depth1%cdepth2
|
||||
depth1%cdepth2
|
||||
depth1%cdepth2
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$depth0 = "depth0";
|
||||
$depth1 = "depth1";
|
||||
$depth2 = "depth2";
|
||||
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
|
||||
mkdir($targetDir, 0777, true);
|
||||
touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPathname_test_2.tmp');
|
||||
touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . 'getSubPathname_test_3.tmp');
|
||||
touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 'getSubPathname_test_1.tmp');
|
||||
$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0);
|
||||
$it = new RecursiveIteratorIterator($iterator);
|
||||
|
||||
$list = [];
|
||||
$it->rewind(); //see https://bugs.php.net/bug.php?id=62914
|
||||
while($it->valid()) {
|
||||
$list[] = $it->getSubPathname();
|
||||
$it->next();
|
||||
}
|
||||
asort($list);
|
||||
foreach ($list as $item) {
|
||||
echo $item . "\n";
|
||||
}
|
||||
?><?php
|
||||
function rrmdir($dir) {
|
||||
foreach(glob($dir . '/*') as $file) {
|
||||
if(is_dir($file)) {
|
||||
rrmdir($file);
|
||||
} else {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
$targetDir = __DIR__ . DIRECTORY_SEPARATOR . "depth0";
|
||||
rrmdir($targetDir);
|
||||
?>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
.
|
||||
..
|
||||
depth1%c.
|
||||
depth1%c..
|
||||
depth1%cdepth2%c.
|
||||
depth1%cdepth2%c..
|
||||
depth1%cdepth2%cgetSubPathname_test_2.tmp
|
||||
depth1%cgetSubPathname_test_3.tmp
|
||||
getSubPathname_test_1.tmp
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$array = array(PHP_INT_MAX => 'foo');
|
||||
$splArray = new SplFixedArray();
|
||||
|
||||
try {
|
||||
$splArray->fromArray($array);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
integer overflow detected
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push("top");
|
||||
$list->bottom(array());
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push("top");
|
||||
$list->bottom(3.14159);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push("top");
|
||||
$list->bottom(45);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push("top");
|
||||
$list->bottom(null);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
|
||||
$c = $list->count('foo');
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$dll = new SplDoublyLinkedList(2);
|
||||
$dll->count(new SplDoublyLinkedList(2));
|
||||
?>
|
||||
+1
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
var_dump($list->current());
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
NULL
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
$list = new SplDoublyLinkedList();
|
||||
var_dump($list->current());
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
NULL
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
// Create a new Doubly Linked List
|
||||
$dll = new SplDoublyLinkedList();
|
||||
|
||||
// Add some items to the list
|
||||
$dll->push(1);
|
||||
$dll->push(2);
|
||||
$dll->push(3);
|
||||
|
||||
// Check the debug info
|
||||
print_r($dll);
|
||||
?>
|
||||
@@ -0,0 +1,11 @@
|
||||
SplDoublyLinkedList Object
|
||||
(
|
||||
[flags:SplDoublyLinkedList:private] => 0
|
||||
[dllist:SplDoublyLinkedList:private] => Array
|
||||
(
|
||||
[0] => 1
|
||||
[1] => 2
|
||||
[2] => 3
|
||||
)
|
||||
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_KEEP);
|
||||
echo $list->getIteratorMode();
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->getIteratorMode(24);
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
// Create a new Doubly Linked List
|
||||
$dll = new SplDoublyLinkedList();
|
||||
|
||||
var_dump($dll->isEmpty("test"));
|
||||
?>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
// Create a new Doubly Linked List
|
||||
$dll = new SplDoublyLinkedList();
|
||||
|
||||
var_dump($dll->isEmpty());
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
bool(true)
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
// Create a new Doubly Linked List
|
||||
$dll = new SplDoublyLinkedList();
|
||||
|
||||
// Add some items to the list
|
||||
$dll->push(1);
|
||||
$dll->push(2);
|
||||
$dll->push(3);
|
||||
//var_dump($dll);
|
||||
|
||||
var_dump($dll->isEmpty("test"));
|
||||
?>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
// Create a new Doubly Linked List
|
||||
$dll = new SplDoublyLinkedList();
|
||||
|
||||
// Add some items to the list
|
||||
$dll->push(1);
|
||||
$dll->push(2);
|
||||
$dll->push(3);
|
||||
//var_dump($dll);
|
||||
|
||||
var_dump($dll->isEmpty());
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
bool(false)
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
|
||||
$list->push('o');
|
||||
$list->push('o');
|
||||
$list->push('f');
|
||||
|
||||
$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
|
||||
|
||||
$list->rewind();
|
||||
|
||||
while ($tmp = $list->current()) {
|
||||
echo $tmp;
|
||||
$list->next();
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
foo
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
$a = $list->offsetExists();
|
||||
if(is_null($a)) {
|
||||
echo 'PASS';
|
||||
}
|
||||
?>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
PASS
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
|
||||
// Push two values onto the list
|
||||
$list->push('abc');
|
||||
$list->push('def');
|
||||
|
||||
// Validate that we can see the first value
|
||||
if($list->offsetExists(0) === true) {
|
||||
echo "PASS\n";
|
||||
}
|
||||
|
||||
// Validate that we can see the second value
|
||||
if($list->offsetExists(1) === true) {
|
||||
echo "PASS\n";
|
||||
}
|
||||
|
||||
// Check that there is no third value
|
||||
if($list->offsetExists(2) === false) {
|
||||
echo "PASS\n";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,3 @@
|
||||
PASS
|
||||
PASS
|
||||
PASS
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$array = new SplDoublyLinkedList( );
|
||||
|
||||
$get = $array->offsetGet();
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$dll = new SplDoublyLinkedList();
|
||||
$dll->push(1);
|
||||
$dll->push(2);
|
||||
|
||||
var_dump($dll->offsetGet());
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$array = new SplDoublyLinkedList( );
|
||||
|
||||
$get = $array->offsetGet( array( 'fail' ) );
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
HipHop Fatal error: %a
|
||||
Stack trace:
|
||||
#0 %s
|
||||
#1 {main}
|
||||
thrown in hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_array.php on line %d
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$array = new SplDoublyLinkedList( );
|
||||
|
||||
$get = $array->offsetGet( 'fail' );
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
HipHop Fatal error: %a
|
||||
Stack trace:
|
||||
#0 %s
|
||||
#1 {main}
|
||||
thrown in hphp/test/zend/bad/ext-spl/SplDoublyLinkedList_offsetGet_param_string.php on line %d
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
$a = $list->offsetSet();
|
||||
if(is_null($a)) {
|
||||
echo 'PASS';
|
||||
}
|
||||
?>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
PASS
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
$a = $list->offsetSet(2);
|
||||
if(is_null($a)) {
|
||||
echo 'PASS';
|
||||
}
|
||||
?>
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
PASS
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$ll = new SplDoublyLinkedList();
|
||||
|
||||
$ll->push('1');
|
||||
$ll->push('2');
|
||||
$ll->push('3');
|
||||
|
||||
try {
|
||||
|
||||
$ll->offsetUnset($ll->count() + 1);
|
||||
|
||||
var_dump($ll);
|
||||
|
||||
} catch(Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
||||
+1
@@ -0,0 +1 @@
|
||||
Offset out of range
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
// Create a new Doubly Linked List
|
||||
$dll = new SplDoublyLinkedList();
|
||||
|
||||
// Add some items to the list
|
||||
$dll->push(1);
|
||||
$dll->push(2);
|
||||
$dll->push(3);
|
||||
|
||||
try {
|
||||
$dll->offsetUnset(-1);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
?>
|
||||
+1
@@ -0,0 +1 @@
|
||||
Offset out of range
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
// Create a new Doubly Linked List
|
||||
$dll = new SplDoublyLinkedList();
|
||||
|
||||
// Add some items to the list
|
||||
$dll->push(1);
|
||||
$dll->push(2);
|
||||
$dll->push(3);
|
||||
|
||||
try {
|
||||
$dll->offsetUnset(3);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
}
|
||||
?>
|
||||
+1
@@ -0,0 +1 @@
|
||||
Offset out of range
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$ll = new SplDoublyLinkedList();
|
||||
$ll->push(1);
|
||||
$ll->push(2);
|
||||
|
||||
var_dump($ll->pop(1));
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$array = new SplDoublyLinkedList( );
|
||||
|
||||
$get = $array->pop( 'param' );
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$dll = new SplDoublyLinkedList();
|
||||
var_dump($dll->push());
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
$q = new SplQueue();
|
||||
|
||||
$q->enqueue("a");
|
||||
$q->enqueue("b");
|
||||
|
||||
var_dump($q, $ss = serialize($q), unserialize($ss));
|
||||
|
||||
$s = new SplStack();
|
||||
|
||||
$s->push("a");
|
||||
$s->push("b");
|
||||
|
||||
var_dump($s, $ss = serialize($s), unserialize($ss));
|
||||
?>
|
||||
==END==
|
||||
@@ -0,0 +1,47 @@
|
||||
object(SplQueue)#%d (2) {
|
||||
["flags":"SplDoublyLinkedList":private]=>
|
||||
int(4)
|
||||
["dllist":"SplDoublyLinkedList":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "a"
|
||||
[1]=>
|
||||
string(1) "b"
|
||||
}
|
||||
}
|
||||
string(42) "C:8:"SplQueue":22:{i:4;:s:1:"a";:s:1:"b";}"
|
||||
object(SplQueue)#%d (2) {
|
||||
["flags":"SplDoublyLinkedList":private]=>
|
||||
int(4)
|
||||
["dllist":"SplDoublyLinkedList":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "a"
|
||||
[1]=>
|
||||
string(1) "b"
|
||||
}
|
||||
}
|
||||
object(SplStack)#%d (2) {
|
||||
["flags":"SplDoublyLinkedList":private]=>
|
||||
int(6)
|
||||
["dllist":"SplDoublyLinkedList":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "a"
|
||||
[1]=>
|
||||
string(1) "b"
|
||||
}
|
||||
}
|
||||
string(42) "C:8:"SplStack":22:{i:6;:s:1:"a";:s:1:"b";}"
|
||||
object(SplStack)#%d (2) {
|
||||
["flags":"SplDoublyLinkedList":private]=>
|
||||
int(6)
|
||||
["dllist":"SplDoublyLinkedList":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
string(1) "a"
|
||||
[1]=>
|
||||
string(1) "b"
|
||||
}
|
||||
}
|
||||
==END==
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$dll = new SplDoublyLinkedList(2);
|
||||
$dll->setIteratorMode(new SplDoublyLinkedList(2));
|
||||
?>
|
||||
+1
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push("top");
|
||||
$list->top(array());
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push("top");
|
||||
$list->top(3.14159);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push("top");
|
||||
$list->top(45);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push("top");
|
||||
$list->top(null);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1 @@
|
||||
HipHop Warning: %a
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$dll = new SplDoublyLinkedList();
|
||||
var_dump($dll->unshift());
|
||||
?>
|
||||
@@ -0,0 +1,2 @@
|
||||
HipHop Warning: %a
|
||||
NULL
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->push('oh');
|
||||
$list->push('hai');
|
||||
$list->push('thar');
|
||||
$list->offsetUnset(0);
|
||||
var_dump($list);
|
||||
?>
|
||||
@@ -0,0 +1,11 @@
|
||||
object(SplDoublyLinkedList)#1 (2) {
|
||||
[%u|b%"flags":%u|b%"SplDoublyLinkedList":private]=>
|
||||
int(0)
|
||||
[%u|b%"dllist":%u|b%"SplDoublyLinkedList":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
%string|unicode%(3) "hai"
|
||||
[1]=>
|
||||
%string|unicode%(4) "thar"
|
||||
}
|
||||
}
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário