Re: com php-src: Added function opcache_compile_file() to load PHP scripts into cache without execution.: NEWS ext/opcache/ZendAccelerator.c
ext/opcache/ZendAccelerator.h ext/opcache/zend_accelerator_module.c
| From: | Dmitry Stogov | Date: | Wed, 25 Sep 2013 20:58:23 +0000 |
| Subject: | Re: com php-src: Added function opcache_compile_file() to load PHP scripts into cache without execution.: NEWS ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h ext/opcache/zend_accelerator_module.c |
||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-73284@lists.php.net to get a copy of this message | ||
This function is going to be used only for cache warm-up (to load files
into cache without execution).
I don't think it may be useful in application code.
It 's not a big problem having warning and hiding it with @ if necessary.
Thanks. Dmitry.
On Wed, Sep 25, 2013 at 8:06 PM, Adam Harvey <aharvey@php.net> wrote:
> On 25 September 2013 01:14, Dmitry Stogov <dmitry@php.net> wrote:
> > + zend_try {
> > + op_array = persistent_compile_file(&handle, ZEND_INCLUDE
> TSRMLS_CC);
> > + } zend_catch {
> > + EG(current_execute_data) = orig_execute_data;
> > + zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " could
> not compile file %s" TSRMLS_CC, handle.filename);
> > + } zend_end_try();
>
> I'm writing the documentation for this, and I'm wondering: does the
> warning serve any purpose here? Is there an intended situation where
> opcache_compile_file() would return false and wouldn't generate a
> warning? (I can see some code paths in persistent_compile_file() that
> probably result in that, but I don't know how intentional that is.)
>
> If there isn't, I'm thinking it would be better to just return false
> without the warning — users who are doing error handling and have
> error reporting on don't need to use @ in that case. I know that's a
> constant irritant for me when I'm writing code that uses fopen(), for
> instance. :)
>
> Adam
>