Doc #66688 [NEW]: Direct invokation of a static method inside an abstract class
| From: | nikola at petkanski dot com | Date: | Mon, 10 Feb 2014 18:51:42 +0000 |
| Subject: | Doc #66688 [NEW]: Direct invokation of a static method inside an abstract class | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-10975@lists.php.net to get a copy of this message | ||
From: nikola at petkanski dot com
Operating system:
PHP version: 5.4.25
Package: Class/Object related
Bug Type: Documentation Problem
Bug description:Direct invokation of a static method inside an abstract class
Description:
------------
---
From manual page: http://www.php.net/language.oop5.abstract
---
Invoking static method of abstract class should be removed.
What interfaces are?
- A mean to ensure all implementation have the same methods
implemented.
What is an abstract class?
- It is a interface that can also include some concrete methods.
Is it right for the developer to be able to invoke a static method of an
interface?
- I think not.
The GoF teach us to rely on abstract classes and interfaces to hide
differences between subclasses from clients.
- Interface defines an objectâs use (protocol)
- Implementation defines particular policy
I don't think one should be able to call some abstract logic that is
defined inside an abstract class, without even inheriting the class
itself.
This post from the mailing list seem relevant:
- http://marc.info/?l=php-internals&m=114120699223033&w=2
Perhaps there are some reasons behind this behavior. However, the
language evolves and I think it is time for this one to go.
Test script:
---------------
http://pastebin.com/a5bG6hww
Expected result:
----------------
It should display an error that one cannot invoke abstract class
methods.
Actual result:
--------------
It just works, while it should not.
--
Edit bug report at https://bugs.php.net/bug.php?id=66688&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66688&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66688&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66688&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66688&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66688&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66688&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66688&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66688&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66688&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66688&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66688&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66688&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66688&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66688&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66688&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66688&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66688&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66688&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66688&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66688&r=mysqlcfg