Bug #71119 [NEW]: Cannot override methods on extended classes
From: chazmead89 at gmail dot com
Operating system: Mac OSX 10.8.5
PHP version: 7.0.0
Package: *General Issues
Bug Type: Bug
Bug description:Cannot override methods on extended classes
Description:
------------
PHP Warning: Declaration of B::foo(string $boo) should be compatible
with A::foo(array $bar) in php shell code on line 3
This should not be a warning... this is basic method overriding, and
should be perfectly good code.
For some reason I get a fatal error on apache handler, but only warning
on CLI, possibly Xdebug RC4 escalating it as a bug in XDdebug.
Test script:
---------------
class A {
public function foo(string $bar) { print_r($bar); }
}
class B extends A {
public function foo(array $bar) { print_r($bar); }
}
Actual result:
--------------
PHP Warning: Declaration of B::foo(string $boo) should be compatible
with A::foo(array $bar) in php shell code on line 3
Warning: Declaration of B::foo(string $boo) should be compatible with
A::foo(array $bar) in php shell code on line 3
--
Edit bug report at https://bugs.php.net/bug.php?id=71119&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71119&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71119&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71119&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71119&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71119&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71119&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71119&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71119&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71119&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71119&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71119&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71119&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71119&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71119&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71119&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71119&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71119&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71119&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71119&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71119&r=mysqlcfg
Thread (8 messages)
- chazmead89 at gmail dot com