Bug #66066 [Com]: opcache_compile_file partially execute file and output errors

From: Date: Sun, 12 Jan 2014 15:57:24 +0000
Subject: Bug #66066 [Com]: opcache_compile_file partially execute file and output errors
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183735@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66066&edit=1 ID: 66066 Comment by: Terry at ellisons dot org dot uk Reported by: geompse at gmail dot com Summary: opcache_compile_file partially execute file and output errors Status: Open Type: Bug Package: opcache Operating System: Debian 3.8.13 PHP Version: 5.5.5 Block user comment: N Private report: N New Comment: This is "Not a bug". What you are describing is the behaviour that we'd expect with PHP and OPcache, so why is it a bug? EG(function_table) already contains an entry for function coucou, so compiling any script with coucou in it will result in a "Cannot redeclare" error being thrown. Previous Comments: ------------------------------------------------------------------------ [2013-11-08 16:18:00] geompse at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.opcache-compile-file "Compiles and caches a PHP script without executing it" --- As the documentation says, the script should not be executed (and it is not). But when trying to compile the current file, or an already included/required file, the function generate a Fatal Error and a Warning (wich can both by visually suppressed when using "@"). Practical use : updater script - overwrite files with new ones - force opcache recompilation The update is in the framework, and updates the framework. All already-included classes are already defined, and thus the compilation fail (or seems to fail, anyways it reports a failure). Test script: --------------- <?php error_reporting(E_ALL); ini_set('display_errors','On'); function coucou() { } echo 'Before'."\n"; opcache_compile_file(__FILE__); echo 'After'."\n"; ?> Expected result: ---------------- Before After Actual result: -------------- Before Fatal error: Cannot redeclare coucou() (previously declared in /root/compile.php:8) in /root/compile.php on line 8 Warning: Zend OPcache could not compile file /root/compile.php in Unknown on line 0 After ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66066&edit=1

« previous php.bugs (#183735) next »