Skip to content

Commit 4f7c13c

Browse files
committed
More spl fixes
1 parent 29483fe commit 4f7c13c

6 files changed

+26
-40
lines changed

ext/spl/tests/SplFileObject_seek_error_001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ try {
99
echo($e->getMessage());
1010
}
1111
?>
12-
--EXPECT--
13-
Can't seek file %s to negative line %s
12+
--EXPECTF--
13+
Can't seek file %s to negative line -1

ext/spl/tests/arrayObject_exchangeArray_basic3.phpt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030
$copy = $ao->exchangeArray();
3131
$copy['addedToCopy'] = 'added To Copy';
3232
} catch (TypeError $e) {
33-
echo "Exception:" . $e->getMessage() . "\n";
33+
echo "Exception: " . $e->getMessage() . "\n";
3434
}
3535
$original->addedToOriginal = 'added To Original';
3636
var_dump($ao, $original, $copy);
@@ -81,8 +81,9 @@ array(2) {
8181

8282

8383
--> exchangeArray() with no arg:
84+
Exception: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given
8485

85-
Warning: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given in %s on line 27
86+
Notice: Undefined variable: copy in %s on line %d
8687
object(ArrayObject)#2 (1) {
8788
["storage":"ArrayObject":private]=>
8889
object(C)#3 (2) {
@@ -98,10 +99,7 @@ object(C)#3 (2) {
9899
["addedToOriginal"]=>
99100
string(17) "added To Original"
100101
}
101-
array(1) {
102-
["addedToCopy"]=>
103-
string(13) "added To Copy"
104-
}
102+
NULL
105103

106104

107105
--> exchangeArray() with bad arg type:

ext/spl/tests/arrayObject_setIteratorClass_error1.phpt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,7 @@ try {
4343

4444
?>
4545
--EXPECTF--
46-
Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given in %s on line 4
47-
a=>1
48-
b=>2
49-
c=>3
50-
51-
Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given in %s on line 14
52-
a=>1
53-
b=>2
54-
c=>3
46+
string(118) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given"
47+
string(110) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given"
5548
string(113) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClass' given"
5649
string(105) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'stdClass' given"

ext/spl/tests/fileobject_005.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,5 @@ unlink($path);
3030
?>
3131
--EXPECTF--
3232
bool(true)
33-
34-
Warning: SplFileObject::fgets() expects exactly 0 parameters, 1 given in %s on line %d
35-
NULL
33+
string(4) "blah"
3634
==DONE==

ext/spl/tests/iterator_044.phpt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,16 @@ class MyCachingIterator extends CachingIterator
2424
{
2525
echo "===$k===\n";
2626
var_dump($v);
27-
var_dump($this->offsetExists($v));
28-
var_dump($this->offsetGet($v));
27+
try {
28+
var_dump($this->offsetExists($v));
29+
} catch (TypeError $e) {
30+
echo $e->getMessage(), "\n";
31+
}
32+
try {
33+
var_dump($this->offsetGet($v));
34+
} catch (TypeError $e) {
35+
echo $e->getMessage(), "\n";
36+
}
2937
}
3038
}
3139
}
@@ -68,7 +76,6 @@ $it->test($checks);
6876
--EXPECTF--
6977
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
7078
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
71-
7279
===0===
7380
int(0)
7481
bool(false)
@@ -78,12 +85,8 @@ NULL
7885
===1===
7986
object(stdClass)#%d (0) {
8087
}
81-
82-
Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d
83-
NULL
84-
85-
Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d
86-
NULL
88+
CachingIterator::offsetExists() expects parameter 1 to be string, object given
89+
CachingIterator::offsetGet() expects parameter 1 to be string, object given
8790
===2===
8891
object(MyFoo)#%d (0) {
8992
}
@@ -123,12 +126,8 @@ int(0)
123126
===1===
124127
object(stdClass)#1 (0) {
125128
}
126-
127-
Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d
128-
NULL
129-
130-
Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d
131-
NULL
129+
CachingIterator::offsetExists() expects parameter 1 to be string, object given
130+
CachingIterator::offsetGet() expects parameter 1 to be string, object given
132131
===2===
133132
object(MyFoo)#2 (0) {
134133
}

ext/spl/tests/spl_004.phpt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ int(5)
8686
int(6)
8787
int(4)
8888
===ERRORS===
89-
Error: Argument 3 passed to iterator_apply() must be of the type array or null, int given
90-
Error: iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name
91-
NULL
92-
Error: iterator_apply() expects at most 3 parameters, 4 given
93-
NULL
89+
Argument 3 passed to iterator_apply() must be of the type array or null, int given
90+
iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name
91+
iterator_apply() expects at most 3 parameters, 4 given
9492
===DONE===

0 commit comments

Comments
 (0)