FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Variable expansion <?=$foo?> not working anymore
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Variable expansion <?=$foo?> not working anymore [message #170654] Sat, 13 November 2010 22:29 Go to next message
Johannes Bauer is currently offline  Johannes Bauer
Messages: 2
Registered: November 2010
Karma: 0
Junior Member
Hello group,

I use variable expansion like

<?=$HTTP_POST_VARS["foo"]?>

in some of my scripts. After updating to 5.3.3 (and possibly some
php.ini configuration updates), this expansion stopped working (it is
just put in literally into the document).

Since I do not know what that type of expansion is called and searches
for "php <?=$" were not really successful, I'd like to know: Is this
deprecated? If not, how do I reenable it?

Kind regards,
Johannes

--
>> Wo hattest Du das Beben nochmal GENAU vorhergesagt?
> Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
- Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1(at)speranza(dot)aioe(dot)org>
Re: Variable expansion <?=$foo?> not working anymore [message #170655 is a reply to message #170654] Sat, 13 November 2010 22:58 Go to previous messageGo to next message
Gregor Kofler is currently offline  Gregor Kofler
Messages: 69
Registered: September 2010
Karma: 0
Member
Am 2010-11-13 23:29, Johannes Bauer meinte:
> Hello group,
>
> I use variable expansion like
>
> <?=$HTTP_POST_VARS["foo"]?>
>
> in some of my scripts. After updating to 5.3.3 (and possibly some
> php.ini configuration updates), this expansion stopped working (it is
> just put in literally into the document).
>
> Since I do not know what that type of expansion is called and searches
> for "php <?=$" were not really successful, I'd like to know: Is this
> deprecated? If not, how do I reenable it?

The setting short_open_tag is disabled [1].
Either enable it in your php.ini or - much better - switch to proper
notation (in your case replace the <?= ... ?> with <?php echo ... ?>).

Gregor


[1]
http://php.net/manual/en/ini.core.php

--
http://vxjs.gregorkofler.com
Re: Variable expansion <?=$foo?> not working anymore [message #170656 is a reply to message #170654] Sun, 14 November 2010 01:11 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On 13/11/10 22:29, Johannes Bauer wrote:
> Hello group,
>
> I use variable expansion like
>
> <?=$HTTP_POST_VARS["foo"]?>
>
> in some of my scripts. After updating to 5.3.3 (and possibly some
> php.ini configuration updates), this expansion stopped working (it is
> just put in literally into the document).
>
> Since I do not know what that type of expansion is called and searches
> for "php <?=$" were not really successful, I'd like to know: Is this
> deprecated? If not, how do I reenable it?

It wouldn't be something as simple as:

<?php echo $ARRAY_NAME["key"]; ?>

would it?

Rgds

Denis McMahon
Re: Variable expansion <?=$foo?> not working anymore [message #170658 is a reply to message #170654] Sun, 14 November 2010 04:03 Go to previous messageGo to next message
Magno is currently offline  Magno
Messages: 49
Registered: October 2010
Karma: 0
Member
On 11/13/2010 07:29 PM, Johannes Bauer wrote:
> Hello group,
>
> I use variable expansion like
>
> <?=$HTTP_POST_VARS["foo"]?>
>
> in some of my scripts. After updating to 5.3.3 (and possibly some
> php.ini configuration updates), this expansion stopped working (it is
> just put in literally into the document).
>
> Since I do not know what that type of expansion is called and searches
> for "php<?=$" were not really successful, I'd like to know: Is this
> deprecated? If not, how do I reenable it?
>
> Kind regards,
> Johannes
>

I think I heard (or read) they are deprecated, perhaps. Or I think that
not recommended.
....I guess.
Re: Variable expansion <?=$foo?> not working anymore [message #170661 is a reply to message #170655] Sun, 14 November 2010 09:32 Go to previous messageGo to next message
Johannes Bauer is currently offline  Johannes Bauer
Messages: 2
Registered: November 2010
Karma: 0
Junior Member
Am 13.11.2010 23:58, schrieb Gregor Kofler:

>> Since I do not know what that type of expansion is called and searches
>> for "php <?=$" were not really successful, I'd like to know: Is this
>> deprecated? If not, how do I reenable it?
>
> The setting short_open_tag is disabled [1].

It is indeed, thank you very much. Previously it was always enabled -
now it seems that with Gentoo it's disabled by default.

> Either enable it in your php.ini or - much better - switch to proper
> notation (in your case replace the <?= ... ?> with <?php echo ... ?>).

Hm - is the <?= variant deprecated? What's the problem with it?

Kind regards,
Johannes

--
>> Wo hattest Du das Beben nochmal GENAU vorhergesagt?
> Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
- Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1(at)speranza(dot)aioe(dot)org>
Re: Variable expansion <?=$foo?> not working anymore [message #170662 is a reply to message #170661] Sun, 14 November 2010 11:23 Go to previous messageGo to next message
Helmut Chang is currently offline  Helmut Chang
Messages: 22
Registered: September 2010
Karma: 0
Junior Member
Am 14.11.2010 10:32, schrieb Johannes Bauer:

> Hm - is the<?= variant deprecated? What's the problem with it?

This code:

<?$foo = 'foo'?>
<?xml version="1.0"?>
<?=$foo?>

You see it?

Helmut
Re: Variable expansion <?=$foo?> not working anymore [message #170664 is a reply to message #170654] Sun, 14 November 2010 16:10 Go to previous messageGo to next message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(Johannes Bauer)

> Hello group,
>
> I use variable expansion like
>
> <?=$HTTP_POST_VARS["foo"]?>
>
> in some of my scripts. After updating to 5.3.3 (and possibly some
> php.ini configuration updates), this expansion stopped working (it is
> just put in literally into the document).
>
> Since I do not know what that type of expansion is called and searches
> for "php <?=$" were not really successful, I'd like to know: Is this
> deprecated? If not, how do I reenable it?

It's deprecated for various reasons. And the old long arrays are
deprecated too, so the above code should look like this instead:

<?php echo $_POST['foo'];?>

Micha
Re: Variable expansion <?=$foo?> not working anymore [message #170667 is a reply to message #170654] Sun, 14 November 2010 16:50 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Johannes Bauer wrote:

> I use variable expansion like
>
> <?=$HTTP_POST_VARS["foo"]?>
>
> in some of my scripts. After updating to 5.3.3 (and possibly some
> php.ini configuration updates), this expansion stopped working (it is
> just put in literally into the document).
>
> Since I do not know what that type of expansion is called and searches
> for "php <?=$" were not really successful, I'd like to know: Is this
> deprecated? If not, how do I reenable it?

You better don't, and you should fix your libraries instead. But if you
absolutely need to use it, set short_open_tag to 1 in php.ini. Beware
incompatibilities, in particular with different server configurations and
XML declarations.

Both short tags and the $HTTP_* variables are deprecated since PHP 5; use

<?php echo $_POST['foo']; ?>

instead (and you probably want to escape it with, say, htmlspecialchars(),
too).


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: where else can this list be found?
Next Topic: newbie question: Is config.php necessary?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 21:56:23 GMT 2024

Total time taken to generate the page: 0.02405 seconds