Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Opcache CFG jmp optimization with try-finally breaks the exception table #18107

Closed
@SpencerMalone

Description

@SpencerMalone

Description

The following code:

<?phpfunctionreadLinesFrom(string$filename):iterable{if (!is_readable($filename)) {thrownewException("File{$filename} does not exist or is not readable");    }$file =fopen($filename,'r');try {while (($line =fgets($file)) !==false) {yieldtrim($line);        }    }finally {fclose($file);    }}$lines =iterator_to_array(readLinesFrom("/bad/file/path/1"));

when run multiple times withphp -dopcache.enable_cli=on -dopcache.optimization_level=0x0010 -derror_log=/proc/self/fd/2 myfile.php

Resulted in this output:

PHP Warning:  Undefined variable $file in myfile.php on line 15Warning: Undefined variable $file in myfile.php on line 15PHP Fatal error:  Uncaught Exception: File /bad/file/path/1 does not exist or is not readable in myfile.php:7Stack trace:#0 [internal function]: readLinesFrom('/bad/file/path/...')#1 myfile.php(19): iterator_to_array(Object(Generator))#2 {main}Next TypeError: fclose(): Argument #1 ($stream) must be of type resource, null given in myfile.php:15Stack trace:#0 myfile.php(15): fclose(NULL)#1 [internal function]: readLinesFrom('/bad/file/path/...')#2 myfile.php(19): iterator_to_array(Object(Generator))#3 {main}  thrown in myfile.php on line 15Fatal error: Uncaught Exception: File /bad/file/path/1 does not exist or is not readable in myfile.php:7Stack trace:#0 [internal function]: readLinesFrom('/bad/file/path/...')#1 myfile.php(19): iterator_to_array(Object(Generator))#2 {main}Next TypeError: fclose(): Argument #1 ($stream) must be of type resource, null given in myfile.php:15Stack trace:#0 myfile.php(15): fclose(NULL)#1 [internal function]: readLinesFrom('/bad/file/path/...')#2 myfile.php(19): iterator_to_array(Object(Generator))#3 {main}  thrown in myfile.php on line 15

But when run withphp -dopcache.enable_cli=on -dopcache.optimization_level=0 -derror_log=/proc/self/fd/2 myfile.php I get this instead:

PHP Fatal error:  Uncaught Exception: File /bad/file/path/1 does not exist or is not readable in myfile.php:7Stack trace:#0 [internal function]: readLinesFrom('/bad/file/path/...')#1 myfile.php(19): iterator_to_array(Object(Generator))#2 {main}  thrown in myfile.php on line 7Fatal error: Uncaught Exception: File /bad/file/path/1 does not exist or is not readable in myfile.php:7Stack trace:#0 [internal function]: readLinesFrom('/bad/file/path/...')#1 myfile.php(19): iterator_to_array(Object(Generator))#2 {main}  thrown in myfile.php on line 7

Slightly unsure if this is just another example of issue#8269 or not

PHP Version

PHP 8.3.16 and PHP 8.2.19

Operating System

Amazon Linux 2 and MacOS 15.2 (likely not relevant?)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp