#44406 [Fbk]: Problem with use of 'require' or 'include'
| From: | jani@php.net | Date: | Tue, 11 Mar 2008 21:32:51 +0000 |
| Subject: | #44406 [Fbk]: Problem with use of 'require' or 'include' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123183@lists.php.net to get a copy of this message | ||
ID: 44406
Updated by: jani@php.net
Reported By: dennis at studiomagenta dot co dot th
Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Linux Apache 1.3.41
PHP Version: 5.2.5
New Comment:
Note: In _both_ files!
Previous Comments:
------------------------------------------------------------------------
[2008-03-11 21:32:35] jani@php.net
Try removing the trailing ?> (it's optional anyway..)
------------------------------------------------------------------------
[2008-03-11 11:35:44] dennis at studiomagenta dot co dot th
Description:
------------
After including a 'require' statement in my PHP script I found that an
echoed output of variables in the same script inserted an unwanted and
unexpected space character (%20) before the first variable name. I found
the same problem when using 'include' instead of 'require'. The included
PHP script is located in the root of the web server, not in the public
area.
This space character effectively corrupted the name of the variable
which caused it not to be recognised by my receiving Flash program.
Output before including the 'require' statement:
reply=valid user&company_name=ABC
Output after including the 'require' statement:
%20reply=valid user&company_name=ABC
Reproduce code:
---------------
<?php
require '../../userpass.php';
echo "reply=valid user&company_name=ABC";
?>
And the sample code for the required file userpass.php:
<?php
$mySQLdatabase = 'some_database';
$mySQLusername = 'some_login';
$mySQLpassword = 'some_password';
?>
Expected result:
----------------
reply=valid user&company_name=ABC
Actual result:
--------------
%20reply=valid user&company_name=ABC
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44406&edit=1