php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75542 class not found without opcache loaded
Submitted: 2017-11-20 13:29 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: spam2 at rhsoft dot net Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 7.2Git-2017-11-20 (Git) OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-11-20 13:29 UTC] spam2 at rhsoft dot net
Description:
------------
harry@rh:/downloads]$ php test.php

Fatal error: Uncaught Error: Class 'B' not found in /mnt/data/downloads/test.php:3
Stack trace:
#0 {main}
  thrown in /mnt/data/downloads/test.php on line 3
____________________________

[harry@rh:/downloads]$ php-opcache test.php
bla
____________________________

[harry@rh:/downloads]$ cat test.php
<?php declare(strict_types=1);

echo (new B)->test('bla'), "\n";


class B extends A
{
 public function test($input): string
 {
  return parent::test($input);
 }
}

class A
{
 public function test(string $input): string
 {
  return $input;
 }
}

Test script:
---------------
[harry@rh:/downloads]$ cat test.php
<?php declare(strict_types=1);

echo (new B)->test('bla'), "\n";


class B extends A
{
 public function test($input): string
 {
  return parent::test($input);
 }
}

class A
{
 public function test(string $input): string
 {
  return $input;
 }
}

Expected result:
----------------
this is a major bug - the class at bottom defined in the same file is explected to be found without opcache loaded

[harry@rh:/downloads]$ which php
/usr/bin/php

[harry@rh:/downloads]$ which php-opcache
alias php-opcache='/usr/bin/php -d "zend_extension=opcache.so" -d "opcache.enable_cli=1"'
        /usr/bin/php

Actual result:
--------------
class only found when opcache is loaded

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-13 07:32 UTC] ustimenko dot alexander at gmail dot com
Seems to repeats under PHP 7.1.12 (cli)
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Dec 02 04:01:24 2020 UTC