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: Feedback
+Status: Open
Type: Bug
Package: Performance problem
Operating System: Ubuntu 11.10
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
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;
}
Previous Comments:
------------------------------------------------------------------------
[2012-02-21 06:59:19] [email protected]
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