1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 19:52:20 +02:00
Files
archived-php-src/ext/spl/tests/bug54384.phpt
Peter Kokot d679f02295 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:33:09 +02:00

171 lines
3.7 KiB
PHP

--TEST--
Bug #54384: Several SPL classes crash when the parent constructor is not called
--FILE--
<?php
function test($f) {
try {
$f();
echo "ran normally (unexpected)\n\n";
} catch (LogicException $e) {
echo "exception (expected)\n";
}
}
echo "IteratorIterator... ";
class IteratorIteratorTest extends IteratorIterator {
function __construct(){}
}
test( function() {
$o = new IteratorIteratorTest;
$o->rewind();
} );
echo "FilterIterator... ";
class FilterIteratorTest extends FilterIterator {
function __construct(){}
function accept(){}
}
test( function() {
$o = new FilterIteratorTest;
$o->rewind();
} );
echo "RecursiveFilterIterator... ";
class RecursiveFilterIteratorTest extends RecursiveFilterIterator {
function __construct(){}
function accept(){}
}
test( function() {
$o = new RecursiveFilterIteratorTest;
$o->hasChildren();
} );
echo "ParentIterator... ";
class ParentIteratorTest extends ParentIterator {
function __construct(){}
}
test ( function() {
$o = new ParentIteratorTest;
$o->accept();
} );
echo "LimitIterator... ";
class LimitIteratorTest extends LimitIterator {
function __construct(){}
}
test ( function() {
$o = new LimitIteratorTest;
$o->rewind();
} );
echo "CachingIterator... ";
class CachingIteratorTest extends CachingIterator {
function __construct(){}
}
test ( function() {
$o = new CachingIteratorTest;
$o->rewind();
} );
echo "RecursiveCachingIterator... ";
class RecursiveCachingIteratorTest extends RecursiveCachingIterator {
function __construct(){}
}
test ( function() {
$o = new RecursiveCachingIteratorTest;
$o->rewind();
} );
echo "NoRewindIterator... ";
class NoRewindIteratorTest extends NoRewindIterator {
function __construct(){}
}
test ( function() {
$o = new NoRewindIteratorTest;
$o->valid();
} );
echo "RegexIterator... ";
class RegexIteratorTest extends RegexIterator {
function __construct(){}
}
test ( function() {
$o = new RegexIteratorTest;
$o->rewind();
} );
echo "RecursiveRegexIterator... ";
class RecursiveRegexIteratorTest extends RecursiveRegexIterator {
function __construct(){}
}
test ( function() {
$o = new RecursiveRegexIteratorTest;
$o->hasChildren();
} );
echo "GlobIterator... ";
class GlobIteratorTest extends GlobIterator {
function __construct(){}
}
test ( function() {
$o = new GlobIteratorTest;
$o->count();
} );
echo "SplFileObject... ";
class SplFileObjectTest extends SplFileObject {
function __construct(){}
}
test ( function() {
$o = new SplFileObjectTest;
$o->rewind();
} );
echo "SplTempFileObject... ";
class SplTempFileObjectTest extends SplTempFileObject {
function __construct(){}
}
test ( function() {
$o = new SplTempFileObjectTest;
$o->rewind();
} );
echo "AppendIterator... ";
class AppendIteratorTest extends AppendIterator {
function __construct(){}
}
test ( function() {
$o = new AppendIteratorTest;
foreach ($o as $a) {
echo $a,"\n";
}
} );
echo "InfiniteIterator... ";
class InfiniteIteratorTest extends InfiniteIterator {
function __construct(){}
}
test ( function() {
$o = new InfiniteIteratorTest;
foreach ($o as $a) {
echo $a,"\n";
}
} );
--EXPECT--
IteratorIterator... exception (expected)
FilterIterator... exception (expected)
RecursiveFilterIterator... exception (expected)
ParentIterator... exception (expected)
LimitIterator... exception (expected)
CachingIterator... exception (expected)
RecursiveCachingIterator... exception (expected)
NoRewindIterator... exception (expected)
RegexIterator... exception (expected)
RecursiveRegexIterator... exception (expected)
GlobIterator... exception (expected)
SplFileObject... exception (expected)
SplTempFileObject... exception (expected)
AppendIterator... exception (expected)
InfiniteIterator... exception (expected)