php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58774 [require|include]_once will be ignored
Submitted: 2009-07-24 06:50 UTC Modified: 2016-08-31 15:17 UTC
From: marc dot bennewitz at giata dot de Assigned: cmb (profile)
Status: Wont fix Package: APC (PECL)
PHP Version: 5_3 CVS-2009-07-24 (dev) OS: Linux version 2.6.22.19-0.2-defa
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-07-24 06:50 UTC] marc dot bennewitz at giata dot de
Description:
------------
Only on one position in my script all [require|include]_once calls will be ignored:

I'm running php5.3-200907240630 with the following APC:
APC Support => enabled
Version => 3.1.3-dev
MMAP Support => Enabled
MMAP File Mask => /tmp/apc.cqTqpy
Locking type => pthread mutex Locks
Revision => $Revision: 284590 $
Build Date => Jul 24 2009 11:06:59

Directive => Local Value => Master Value
apc.cache_by_default => On => On
apc.canonicalize => On => On
apc.coredump_unmap => Off => Off
apc.enable_cli => On => On
apc.enabled => On => On
apc.file_md5 => Off => Off
apc.file_update_protection => 2 => 2
apc.filters => no value => no value
apc.gc_ttl => 3600 => 3600
apc.include_once_override => On => On
apc.lazy_classes => Off => Off
apc.lazy_functions => Off => Off
apc.max_file_size => 1M => 1M
apc.mmap_file_mask => /tmp/apc.cqTqpy => /tmp/apc.cqTqpy
apc.num_files_hint => 1024 => 1024
apc.preload_path => no value => no value
apc.report_autofilter => Off => Off
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.rfc1867_ttl => 3600 => 3600
apc.shm_segments => 1 => 1
apc.shm_size => 128 => 128
apc.stat => On => On
apc.stat_ctime => Off => Off
apc.ttl => 7200 => 7200
apc.use_request_time => On => On
apc.user_entries_hint => 4096 => 4096
apc.user_ttl => 7200 => 7200
apc.write_lock => On => On


NOTE 1: If I disable apc.include_once_override than it works.

NOTE 2:
If I change apc_zend.c to following this works, too. But it is not a good work:
    if (zend_hash_exists(&EG(included_files), realpath, strlen(realpath) + 1)) {

// added line
return apc_original_opcode_handlers[APC_OPCODE_HANDLER_DECODE(opline)](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);

        if (!(opline->result.u.EA.type & EXT_TYPE_UNUSED)) {
            ALLOC_INIT_ZVAL(APC_EX_T(opline->result.u.var).var.ptr);
            ZVAL_TRUE(APC_EX_T(opline->result.u.var).var.ptr);
        }
        if (inc_filename == &tmp_inc_filename) {
            zval_dtor(&tmp_inc_filename);
        }
        if (freeop1) {
            zval_dtor(freeop1);
        }
        execute_data->opline++;
        return 0;
    }

NOTE3:
If I write an apc_delete_file('.../init.inc.php'); before require_once it works. But if I remove this line the problem continue.

Reproduce code:
---------------
index.php:
<?php
require_once('.../init_web.inc.php');
// ...

init_web.inc.php:
<?php
require_once '.../init.inc.php';
die(__FILE__);
// ...

init.inc.php:
<?php
die(__FILE__);
// ...

Expected result:
----------------
.../init.inc.php

Actual result:
--------------
.../init_web.inc.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-27 10:26 UTC] gopalv82 at yahoo dot com
Seriously weird. 

But I plan on turning off include_once override on php5.3, because the branch already has the issue fixed in the core & doesn't need hackery in APC.
 [2010-08-05 04:54 UTC] andrea at bhweb dot it
So it is safe we won't lose much performances turning off 
"include_once_override"? I'm having the same issue on my 
server with php 5.3.3, and it has also been discussed on the 
drupal forum:
http://drupal.org/node/807680
http://drupal.org/node/288570

Thanks
 [2016-08-31 15:17 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2016-08-31 15:17 UTC] cmb@php.net
According to <https://bugs.php.net/69618>, APC support has been
discontinued in favor of OPcache, APCu, the session upload
progress API and WinCache. Therefore this issue won't get fixed.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 02:01:23 2020 UTC