Skip to content

Commit 9b9fac7

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #78429: opcache_compile_file(__FILE__); segfaults
2 parents e6b1f9d + 20f73d3 commit 9b9fac7

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

ext/opcache/tests/bug78429.phpt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Bug #78429 (opcache_compile_file(__FILE__); segfaults)
3+
--SKIPIF--
4+
<?php require_once('skipif.inc'); ?>
5+
--INI--
6+
opcache.enable_cli=0
7+
--FILE--
8+
<?php
9+
var_dump(opcache_compile_file(__FILE__));
10+
?>
11+
--EXPECTF--
12+
Notice: Zend OPcache has not been properly started, can't compile file in %s on line %d
13+
bool(false)

ext/opcache/zend_accelerator_module.c

+5
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,11 @@ static ZEND_FUNCTION(opcache_compile_file)
867867
return;
868868
}
869869

870+
if (!accel_startup_ok) {
871+
zend_error(E_NOTICE, ACCELERATOR_PRODUCT_NAME " has not been properly started, can't compile file");
872+
RETURN_FALSE;
873+
}
874+
870875
zend_stream_init_filename(&handle, script_name);
871876

872877
orig_execute_data = EG(current_execute_data);

0 commit comments

Comments
 (0)