Ниже перечислены новые сообщения об ошибках, не упоминавшиеся
ранее в этом документе.
Пример #1 В ядре PHP
<?php echo " "; session_regenerate_id(); /* Warning: session_regenerate_id(): Cannot regenerate session id - headers already sent in filename on line n */
str_word_count("string", 4); /* Warning: str_word_count(): Invalid format value 4 in filename on line n */
strripos("foo", "f", 4); /* Notice: strripos(): Offset is greater than the length of haystack string in filename on line n */
strrpos("foo", "f", 4); /* Notice: strrpos(): Offset is greater than the length of haystack string in filename on line n */
/* Начиная с PHP 5.2.1, при значении allow_url_include = OFF (по умолчанию) */ include "php://input"; /* Warning: include(): URL file-access is disabled in the server configuration in filename on line n */ ?>
<?php interface foo { } class bar implements foo, foo { } /* Fatal error: Class bar cannot implement previously implemented interface foo in filename on line n */
class foo { public $bar; function __get($var) { return $this->bar; } }
$foo = new foo; $bar =& $foo->prop; /* Notice: Indirect modification of overloaded property foo::$prop has no effect in filename on line n */
class foo implements iterator { public function current() { } public function next() { } public function key() { } public function valid() { } public function rewind() { } }
$foo = new foo(); foreach($foo as &$ref) {} /* Fatal error: An iterator cannot be used with foreach by reference in filename on line n */
class foo { private function __construct() { } } class bar extends foo { public function __construct() { parent::__construct(); /* Fatal error: Cannot call private foo::__construct() in filename on line n */ } } new bar;
stream_filter_register("", "class"); /* Warning: stream_filter_register(): Filter name cannot be empty in filename on line n */
stream_filter_register("filter", ""); /* Warning: stream_filter_register(): Class name cannot be empty in filename on line n */ ?>
<?php strtotime("today", "now"); /* Warning: strtotime() expects parameter 2 to be long, string given in filename on line n */
/* As of PHP 5.2.1 */ new DateTime(new stdclass); /* Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 1 to be string, object given' in filename:n */ ?>
<?php $obj = new SplFileObject(__FILE__); $obj->fgetcsv("foo"); /* Warning: SplFileObject::fgetcsv(): delimiter must be a character in filename on line n */
$obj->fgetcsv(",", "foo"); /* Warning: SplFileObject::fgetcsv(): enclosure must be a character in filename on line n */ ?>
<?php $obj = new ZipArchive(); $obj->open('archive.zip'); $obj->setCommentName('', 'комментарий'); /* Notice: ZipArchive::setCommentName(): Empty string as entry name in filename on line n */
/* Начиная с PHP 5.2.1 */ $obj->getCommentName(''); /* Notice: ZipArchive::getCommentName(): Empty string as entry name in filename on line n */ ?>