Skip to content

Opcache corruption #8846

Closed
Closed
@vnsavage

Description

@vnsavage

Description

The following code:

  1. Clear PHP Opcache
  2. Add files:
$ cat test.php 
<?php
include( 'test-class1.php' );
include( 'test-class2.php' );

$ cat test-class1.php 
<?php
class test_class {
	public static $a = true;
}

$ cat test-class2.php 
<?php
var_dump( test_class::$a );
class test_class {
	public static $a = true;
}
  1. Issue a web request to test.php
  2. Remove the include -> "include( 'test-class1.php' )" from test.php
  3. Issue a second web request to test.php again

Resulted in this output:

First Request: Fatal error: Cannot declare class test_class, because the name is already in use in test-class2.php on line 5
Second Request: Fatal error: Uncaught Error: Class 'test_class' not found in test-class2.php:3 

But I expected this output instead:

First Request: Fatal error: Cannot declare class test_class, because the name is already in use in test-class2.php on line 5
Second request: bool(true)

PHP Version

PHP 8.0

Operating System

Linux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions