Bug #61151 [Opn->Csd]: Incorrectly reports function as being redeclared
| From: | mark-kreine at yandex dot ru | Date: | Tue, 21 Feb 2012 07:33:03 +0000 |
| Subject: | Bug #61151 [Opn->Csd]: Incorrectly reports function as being redeclared | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167677@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61151&edit=1
ID: 61151
User updated by: mark-kreine at yandex dot ru
Reported by: mark-kreine at yandex dot ru
Summary: Incorrectly reports function as being redeclared
-Status: Open
+Status: Closed
Type: Bug
Package: Performance problem
Operating System: Ubuntu 11.10
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
Problem solved.
Previous Comments:
------------------------------------------------------------------------
[2012-02-21 07:17:42] mark-kreine at yandex dot ru
Well, there are many lines of code. If you permit I can send you a tarball of files or attach it
somewhere to this bug report.
Please advise me on how to send you these files.
------------------------------------------------------------------------
[2012-02-21 07:11:46] rasmus@php.net
We'll still need a reproducible test case to do anything here. There is obviously
something you are not telling. A standalone file or tarball of files is needed
since putting just the code you pasted into a file and including it will
obviously not trigger that error.
------------------------------------------------------------------------
[2012-02-21 07:05:49] mark-kreine at yandex dot ru
Thanks for the answer, but the message you see is not true, that is the reason for me to write here.
Following are the lines from 3 till 16 of my code in functions.php:
function get_tree($tree, $pid, $result = array())
{
foreach ($tree as $row)
{
if ($row['parent_cat_id'] == $pid)
{
$result[] = $row;
$result = get_tree($tree, $row['cat_id'], $result);
}
}
return $result;
}
------------------------------------------------------------------------
[2012-02-21 06:59:19] rasmus@php.net
But you haven't given us any way to reproduce this as we can't see your code.
What is on lines 3 and 16 of your functions.php script?
The error message very clearly states that you are declaring get_tree() on line 3
and then again on line 16 of that file.
------------------------------------------------------------------------
[2012-02-21 06:48:31] mark-kreine at yandex dot ru
Description:
------------
I have created a web page which includes files config.php and functions.php. I define basic
constants in config.php while the file "functions.php" is used to define functions.
You can reproduce a problem if you create a page, include first "config.php" then
"functions.php" and just invoke this page from a web browser.
My configure line is as follows:
'./configure' '--prefix=/soft/programs/php'
'--with-apxs2=/soft/programs/apache/bin/apxs'
'--with-config-file-path=/soft/programs/php/ini'
'--with-config-file-scan-dir=/soft/programs/php/additional'
'--with-zlib=shared,/soft/programs/zlib' '--with-bz2=shared,/soft/programs/bzip'
'--with-curl=shared,/soft/programs/curl' '--with-gd=shared,/soft/programs/gd'
'--with-jpeg-dir=/soft/programs/jpeg' '--with-png-dir=/soft/programs/libpng'
'--with-freetype-dir=/soft/programs/freetype'
'--with-gettext=shared,/soft/programs/gettext'
'--with-mysql=shared,/soft/programs/mysql'
'--with-mcrypt=shared,/soft/programs/libmcrypt' '--enable-bcmath'
'--enable-exif' '--enable-ftp' '--enable-calendar'
'--enable-mbstring' '--with-libexpat-dir=/soft/programs/expat'
'--with-libxml-dir=/soft/programs/libxml'
'--with-xsl=shared,/soft/programs/libxslt' '--enable-zip'
Test script:
---------------
You'll find test script here:
http://www.kreine.ru/test/test-script.php
Expected result:
----------------
Normal script execution without any fatal error.
Actual result:
--------------
Fatal error: Cannot redeclare get_tree() (previously declared in ...) in /test/functions.php on line
16
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61151&edit=1