php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42103 Short open tags not work in php5.2.0 and not in php5.2.3
Submitted: 2007-07-25 13:34 UTC Modified: 2007-07-25 15:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: lhanson at clarifysolutions dot co dot uk Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 5.2.3 OS: windows xp/2000
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lhanson at clarifysolutions dot co dot uk
New email:
PHP Version: OS:

 

 [2007-07-25 13:34 UTC] lhanson at clarifysolutions dot co dot uk
Description:
------------
It appears that there is a problem when attempting execute a script from the command line. If the script has Short open tags "<?" instead of "<?php" php.exe does not seem to recognise that we are starting php code. 

I tried to tell php.exe to use a specific ini file (with the -c switch) that had open short tags enabled. However no avail. It also took me quite a long time to realise that it was the tags that was causing me the issue. 

I am wondering what the reasons would be for removing the acceptance of short tags from the command line interface... 

If you have any answers on this please do get in contact 

Reproduce code:
---------------
<?
$i = 10
 echo 'im being displayed in the cli. i = '.$i
?>

Expected result:
----------------
im being displayed in the cli. i = 10


Actual result:
--------------
<?
$i = 10
 echo 'im being displayed in the cli. i = '.$i
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-25 14:24 UTC] jani@php.net
They work just fine here. Check your php.ini settings and that it's actually been read by PHP. You can check it in phpinfo() section where it says what, if any, php.ini was actually loaded. 
 [2007-07-25 14:34 UTC] lhanson at clarifysolutions dot co dot uk
I've checked in the my server setup and it is definitely using the ini file that it should be! Got a feeling when running php.exe under CLI it uses another INI file (or something similar) as the script works perfectly when browsed to. 

I've tried the same script across two different instances of apache php. It works fine in 5.2.0 from a browser and from CLI but with 5.2.3 it works in the browser but not from the CLI.

It is the CLI I wanted to get working.. as it is a backup script. I managed to solve the problem by making the script start with <?php rather than <?.... any other ideas... or knowledge of why a script would run in the browser yet not under the CLI?!

Thank you for your time
Lee
 [2007-07-25 15:22 UTC] lhanson at clarifysolutions dot co dot uk
I have now found why php.exe was NOT working the same as the browser. This is because php.exe although I had attempted to use -c and -n switches to specify the INI location was using a different INI to the apache server.

I found that php.exe was just using the INI within my PHP directory where as apache was using the one I had configured. 

Running phpinfo() gives no hints to this through the browser as it picks up the INI file used by apache. As i had already discerned the issue was with 'short_open_tag', i used ini_get() from the CLI to discern that this was not switched on... I then located the most obvoius INI (in the php directory) and altered the open_short_tag.... hence problem solved... 

why php.exe from the CLI would not use the INI told to by using -c and why php.exe does not pick up and use the same INI as apache is a mystery I have'nt yet unravelled

Thanks
Lee
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC