I'm working with a legacy code that someone had left, and it happens to be my task to re-deploy the code. I'm using Windows Server 2003, Apache 2.0.63 and PHP 5.2.10.
It doesn't work. At least, not in the way I had expected it to work. Call it bugs, if you will.
Upon inspecting, I had a suspicion that this code (which appears numerous times in the application) is the culprit.
&$this->
To illustrate the problem, I reproduce this code:
<?php phpinfo(); //$variable = &$this->request; ?>
The code above executed beautifully and as expected. However, if I change the code to:
<? phpinfo(); //$variable = &$this->request; ?>
The code misbehaves, and produce this result on the screen instead, which of course, totally unwanted and unexpected.
request; ?>
Now, the code is littered with the similar code as above, and as such, the application now produce output on the screen similar to this one:
request; $user = &$this->user; // This is comment return false; ?>
for a code that reads as:
<? $request = &$this->request; $user = &$this->user; // This is comment return false; ?>
I had tried to change every <? with <?php whenever &$this-> rears its ugly head, but most of the time, it introduces a new error instead.
I reinstalled PHP and Apache, even using another version of PHP (5.2.6) and it still won't work. I deployed the code in my localhost (Mac OS X, PHP 5.2.8 and Apache 2.0.63) and it worked without a hassle.
Please, anyone, any enlightenment will more than suffice.
In your php.ini, you need to set the following directive:
short_open_tag = On
From the manual:
Tells whether the short form (
<? ?>
) of PHP's open tag should be allowed...
If you have time on your hands, you may want to consider replacing all those short tags '<?
' with the full-form ones <?php
, for better portability (see what just happened to you? :)
my recommendation is not to use open tags, because it can interfere with <?xml
codes.
I also had that problem before, just go and replace all <?php
to <?
, and then again all <?
to <?php
.
In this way you won't get any
<? <-- one space after the '?'
and
<?php <-- one space after the 'p'
hope this will help...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With