php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77182 Running opcache_compile_file() on the command line segfaults
Submitted: 2018-11-20 15:26 UTC Modified: 2019-12-13 10:17 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: benjamin dot morel at gmail dot com Assigned:
Status: Duplicate Package: opcache
PHP Version: master-Git-2018-11-20 (Git) OS: Fedora 29
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: benjamin dot morel at gmail dot com
New email:
PHP Version: OS:

 

 [2018-11-20 15:26 UTC] benjamin dot morel at gmail dot com
Description:
------------
Even though it does not make sense to call opcache_compile_file() (i.e. attempting to run a preload script) on the CLI, it would make sense to add a specific error message.

Currently I get a segfault:



Test script:
---------------
php -r "opcache_compile_file('test.php');"

Expected result:
----------------
An error message

Actual result:
--------------
Segmentation fault (core dumped)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-21 18:02 UTC] cmb@php.net
Given that the built-in web server runs under the CLI SAPI, it may
well make sense to call opcache_compile_file().

Anyhow, I can't reproduce the segfault.  Please provide a
backtrace[1].

[1] <https://bugs.php.net/bugs-generating-backtrace.php>
 [2018-11-22 11:26 UTC] benjamin dot morel at gmail dot com
Core was generated by `php /var/www/html/preload.php'.
Program terminated with signal SIGSEGV, Segmentation fault.

(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007f6be287849d in persistent_compile_file (file_handle=0x7fff4ef6fe80, type=2) at /root/php-src-master/ext/opcache/ZendAccelerator.c:1890
#2  0x00007f6be288261a in zif_opcache_compile_file (execute_data=0x7f6be2620080, return_value=0x7fff4ef6ff30) at /root/php-src-master/ext/opcache/zend_accelerator_module.c:860
#3  0x00000000009eb2af in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER () at /root/php-src-master/Zend/zend_vm_execute.h:655
#4  0x0000000000a53312 in execute_ex (ex=0x7f6be2620020) at /root/php-src-master/Zend/zend_vm_execute.h:54811
#5  0x0000000000a58948 in zend_execute (op_array=0x7f6be2683300, return_value=0x0) at /root/php-src-master/Zend/zend_vm_execute.h:60215
#6  0x0000000000987a79 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /root/php-src-master/Zend/zend.c:1616
#7  0x00000000008f7648 in php_execute_script (primary_file=0x7fff4ef73730) at /root/php-src-master/main/main.c:2643
#8  0x0000000000a5b4a2 in do_cli (argc=2, argv=0x2670f10) at /root/php-src-master/sapi/cli/php_cli.c:997
#9  0x0000000000a5c422 in main (argc=2, argv=0x2670f10) at /root/php-src-master/sapi/cli/php_cli.c:1389
 [2019-12-13 10:17 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2019-12-13 10:17 UTC] nikic@php.net
I believe this is the same issue as bug #78429, which has been fixed in the meantime. (The relevant detail absent from this report is that it requires opcache.enable_cli=0.)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC