Bug #70435 [NEW]: Wrong return type when opcache is enabled
| From: | peehaa@php.net | Date: | Sat, 05 Sep 2015 19:50:05 +0000 |
| Subject: | Bug #70435 [NEW]: Wrong return type when opcache is enabled | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195788@lists.php.net to get a copy of this message | ||
From: peehaa
Operating system: Windows 7
PHP version: 7.0.0RC2
Package: opcache
Bug Type: Bug
Bug description:Wrong return type when opcache is enabled
Description:
------------
When running on apache with opcache enabled I get a TypeError on the
return value. However the actual return type it is complaining about is
different than the return type I have defined.
It seems as if the CLI is not affected by this.
I tried to isolate the problem code as far as I could, but I couldn't
get it any smaller than this
https://github.com/CodeCollab/Demo/tree/opcache-return-type-bug
At some point it suddenly started working as it should, but after an
apache restart the problem was back.
I will add the specific part of the code that results in the error below
but the actual (working) test case is the linked github repo above.
The part that throws is
https://github.com/CodeCollab/Demo/blob/opcache-return-type-bug/vendor/codecollab/router/src/Router.php#L21.
Windows 7, Apache 2.4.12, PHP RC2
Test script:
---------------
public function addRoute(string $verb, string $path, array
$callback): Router
{
$this->routeCollector->addRoute($verb, $path, $callback);
//var_dump($this); // object(CodeCollab\Router\Router)#5 (4) { ... }
return $this;
}
Expected result:
----------------
Instance of CodeCollab\Router\Router is returned.
Actual result:
--------------
Fatal error: Uncaught TypeError: Return value of
CodeCollab\Router\Router::addRoute() must be an instance of
FastRoute\RouteCollector, instance of CodeCollab\Router\Router returned
in
C:\Users\PeeHaa\Desktop\ph\Websites\CodeCollabLib\Demo\vendor\codecollab\router\src\Router.php
on line 21 in
--
Edit bug report at https://bugs.php.net/bug.php?id=70435&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70435&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70435&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70435&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70435&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70435&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70435&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70435&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70435&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70435&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70435&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70435&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70435&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70435&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70435&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70435&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70435&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70435&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70435&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70435&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70435&r=mysqlcfg