Advertisement
Guest User

Php file inclusion bug.

a guest
Aug 2nd, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. //index.php
  2. <?php
  3. require_once('function.php');
  4. require_once('config.php');
  5.  
  6. echo $myHomeVarable;
  7. doTestFuntion();
  8.  
  9. ?>
  10.  
  11. //function.php
  12. <?php
  13. function doTestFuntion()
  14. {
  15.     //require_once('config.php');// Causes PHP Notice:  Undefined variable: myFunctionVarable in /srv/www/htdocs/fwstest/function.php on line 7
  16.     require('config.php');//Causes PHP Fatal error:  Cannot redeclare trapFunction() (previously declared in /srv/www/htdocs/fwstest/config.php:8) in /srv/www/htdocs/fwstest/config.php on line 9
  17.  
  18.    
  19.     echo $myFunctionVarable;
  20. }
  21. ?>
  22.  
  23. //config.php
  24. <?php
  25.  
  26. $myHomeVarable = 'Home Works';
  27. $myFunctionVarable = 'Function Works';
  28.  
  29. function trapFunction()
  30. {
  31. echo'boo';
  32. }
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement