|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-02-21 06:48 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 17:00:01 2025 UTC |
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; }