From:             ramymb at gmail dot com
Operating system: windows 2003
PHP version:      5.2.3
PHP Bug Type:     Unknown/Other Function
Bug description:  bug in function declaration

Description:
------------
OS: windows 2003 + IIS
PHP Version: 5.2.3

when I'm declare my own function myFun in a file func.php, I'm included
into my main index.php, it's working at first time without any problem,
when I'm using current page to submit data into the same page I'm getting
the following error:

Fatal error: Cannot redeclare myfun() (previously declared in
C:\accounts\panela\tmp\func.php:2) in C:\accounts\panela\tmp\func.php on
line 2

I don't know whats the problem, I'm tried to solve this problem but I'm
failed :(
this error is not logic, and the same script working in other php version
like php 4.X


Reproduce code:
---------------
--- file: func.php ---
<?
function myFun($a,$b){ return $a+$b; }
?>

--- file: index.php ---
<?
include_once("func.php");
?>
<form name="FormName" action="" method="post">
        <input type="submit" value="Send">
</form>


Expected result:
----------------
this code when submit data into same php page.
I'm solved this problem by:


<?
if (!function_exists('myFun')) {                 
   function myFun($a,$b){ return $a+$b; }
}
?>

but unfortunately, when I'm refreshing the page I'm cant see my last
editing in my function, for example, now I will edit the function to:

<?
if (!function_exists('myFun')) {                 
   function myFun($a,$b){ return $a*$b; }
}
?>
now with function_exists I cant see the new function $a*$b, but I'm see
only the old function $a-$b.



-- 
Edit bug report at http://bugs.php.net/?id=42314&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42314&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42314&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42314&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42314&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42314&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42314&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42314&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42314&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42314&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42314&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42314&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42314&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42314&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42314&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42314&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42314&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42314&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42314&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42314&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42314&r=mysqlcfg

Reply via email to