php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59793 Check for already declared functions issue
Submitted: 2011-05-30 07:48 UTC Modified: 2016-11-18 21:41 UTC
Votes:6
Avg. Score:3.7 ± 1.2
Reproduced:5 of 6 (83.3%)
Same Version:1 (20.0%)
Same OS:3 (60.0%)
From: vnsavage at gmail dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vnsavage at gmail dot com
New email:
PHP Version: OS:

 

 [2011-05-30 07:48 UTC] vnsavage at gmail dot com
Description:
------------
When compiling cached opcode, APC does not check if functions 
are already declared.

This seems to be happening because the return value of 
install_function() in cached_compile() is not checked.

If you need more testing or patches, please let me know. I'd 
be glad to help.

Reproduce code:
---------------
Step one:

~# cat index.php

<?php
require('file2.php');
test();

~# cat file2.php

<?php 
function test() { echo 'test() called from file2.php'; }

Load index.php in a browser.

Step two:

~# cat index.php

<?php
require('file1.php');
require('file2.php');
test();

~# cat file1.php

<?php 
function test() { echo 'test() called from file1.php'; }

~# cat file2.php

<?php 
function test() { echo 'test() called from file2.php'; }

Reload index.php in a browser.

Expected result:
----------------
Fatal error: Cannot redeclare test() (previously declared in 
~/file1.php:2) in ~/file2.php on line 2

Actual result:
--------------
test() called from file1.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-18 21:41 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:41 UTC] kalle@php.net
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Dec 01 13:01:47 2020 UTC