From: 1592328848 at qq dot com
Operating system: CentOS Linux release 7.3.1611 (C
PHP version: 8.0.0
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:I think the document should be updated.
Description:
------------
---
From manual page: https://php.net/class.arrayobject
---
When My class inherits the ArrayOsbject class of PHP, the parameters I
need to pass are inconsistent with the PHP Arrayobject document. I think
the document should be updated.
Test script:
---------------
In PHP 7,it is normal.As follows:
<?php
class MyArrayObject extends ArrayObject
{
public function asort()
{
// parent::asort(); // TODO: Change the autogenerated stub
}
public function ksort()
{
// parent::ksort(); // TODO: Change the autogenerated stub
}
}
?>
In PHP 8,there was a fatal error.
<?php
class MyArrayObject extends ArrayObject
{
public function asort()
{
// parent::asort(); // TODO: Change the autogenerated stub
}
public function ksort()
{
// parent::ksort(); // TODO: Change the autogenerated stub
}
}
?>
Run it In PHP 8,it happens a PHP Fatal error.As follows:
PHP Fatal error: Declaration of MyArrayObject::asort() must be
compatible with ArrayObject::asort(int $flags = SORT_REGULAR) in
MyArrayObject_In_PHP8.php on line 13
Fatal error: Declaration of MyArrayObject::asort() must be compatible
with ArrayObject::asort(int $flags = SORT_REGULAR) in
MyArrayObject_In_PHP8.php on line 13
PHP Fatal error: Declaration of MyArrayObject::ksort() must be
compatible with ArrayObject::ksort(int $flags = SORT_REGULAR) in
MyArrayObject_In_PHP7.php on line 19
Fatal error: Declaration of MyArrayObject::ksort() must be compatible
with ArrayObject::ksort(int $flags = SORT_REGULAR) in
MyArrayObject_In_PHP7.php on line 19
Expected result:
----------------
PHP Fatal error: Declaration of MyArrayObject::asort() must be
compatible with ArrayObject::asort(int $flags = SORT_REGULAR) in
MyArrayObject_In_PHP8.php on line 13
Fatal error: Declaration of MyArrayObject::asort() must be compatible
with ArrayObject::asort(int $flags = SORT_REGULAR) in
MyArrayObject_In_PHP8.php on line 13
PHP Fatal error: Declaration of MyArrayObject::ksort() must be
compatible with ArrayObject::ksort(int $flags = SORT_REGULAR) in
MyArrayObject_In_PHP7.php on line 19
Fatal error: Declaration of MyArrayObject::ksort() must be compatible
with ArrayObject::ksort(int $flags = SORT_REGULAR) in
MyArrayObject_In_PHP7.php on line 19
--
Edit bug report at https://bugs.php.net/bug.php?id=80543&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80543&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80543&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80543&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80543&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80543&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80543&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80543&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80543&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80543&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80543&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80543&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80543&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80543&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80543&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80543&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80543&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80543&r=mysqlcfg