[PHP-BUG] Bug #77507 [NEW]: No fatal error when implementing interface method with parameter type declared
[email protected] ("a dot owrew at gmail dot com") Wed, 23 Jan 2019 10:37:42 +0000
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
From: a dot owrew at gmail dot com
Operating system: Linux
PHP version: 7.2.14
Package: PHP Language Specification
Bug Type: Bug
Bug description:No fatal error when implementing interface method with parameter type declared
Description:
------------
As it states in the summary, up until PHP 7.1.26, implementing an
interface method without providing the full signature would cause a
fatal error. Starting PHP 7.2.0 it appears to be more lax. In the
example, the missing string parameter type is causing a fatal error
prior to PHP 7.2.0.
Test script:
---------------
<?php
interface SomeInterface {
public function setSome(string $some);
}
class SomeClass implements SomeInterface {
public function setSome($some){}
}
Expected result:
----------------
Fatal error: Declaration of SomeClass::setSome($some) must be compatible
with SomeInterface::setSome(string $some)
--
Edit bug report at https://bugs.php.net/bug.php?id=77507&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77507&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77507&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77507&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77507&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77507&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77507&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77507&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77507&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77507&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77507&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77507&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77507&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77507&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77507&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77507&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77507&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77507&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77507&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77507&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77507&r=mysqlcfg