Bug #70435 [Opn->Fbk]: Wrong return type when opcache is enabled
| From: | laruence@php.net | Date: | Sun, 06 Sep 2015 15:47:01 +0000 |
| Subject: | Bug #70435 [Opn->Fbk]: Wrong return type when opcache is enabled | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195804@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70435&edit=1
ID: 70435
Updated by: laruence@php.net
Reported by: peehaa@php.net
Summary: Wrong return type when opcache is enabled
-Status: Open
+Status: Feedback
Type: Bug
Package: opcache
Operating System: Windows 7
PHP Version: 7.0.0RC2
Block user comment: N
Private report: N
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Previous Comments:
------------------------------------------------------------------------
[2015-09-05 19:50:03] peehaa@php.net
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 this bug report at https://bugs.php.net/bug.php?id=70435&edit=1