Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PHP-DEV] <?xml tags (was PDM Meeting Notes)

6 views
Skip to first unread message

Daniel Convissor

unread,
Nov 27, 2005, 4:25:11 PM11/27/05
to
Hi Marcus:

On Sun, Nov 27, 2005 at 11:58:16AM +0100, Marcus Boerger wrote:
>
> To second this, the xml standard allows any name after '<?' as processing
> instruction. Widely in use is for example '<?jsp' and do you want to start
> special treatment for java stuff in PHP? ;-)

First, PHP scripts are not XML files, so why are we concerned with what
the XML standard says?

Second, PHP is frequently used to output XML files, necessitating such PHP
scripts contain the string "<?xml" in them. But in order to ensure
scripts work when short tags is on, one must write something contorted
like:

echo '<' . '?xml ...';

Third, if someone wrote a script using "<?xml" with short tags off instead
of the above, PHP needlessly fails if short tags is on, eliminating
portability.

--Dan

--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Johannes Schlueter

unread,
Nov 27, 2005, 4:33:42 PM11/27/05
to
Hi,

On Sunday 27 November 2005 22:20, Daniel Convissor wrote:
> First, PHP scripts are not XML files, so why are we concerned with what
> the XML standard says?

It isn't about the XML standard but about exceptions for the PHP parser and
why should <?xml be treated different from <?jsp or <?xsl or <?foo or ...
which all are used (hm, not sure about <?foo) and sometimes even in
combination with PHP.

> Second, PHP is frequently used to output XML files, necessitating such PHP
> scripts contain the string "<?xml" in them. But in order to ensure
> scripts work when short tags is on, one must write something contorted
> like:
>
> echo '<' . '?xml ...';

echo '<?xml ...';

just works fine.

> Third, if someone wrote a script using "<?xml" with short tags off instead
> of the above, PHP needlessly fails if short tags is on, eliminating
> portability.

so just remove short_tags :-)

johannes

Sara Golemon

unread,
Nov 27, 2005, 5:49:48 PM11/27/05
to
> I recall this being discussed before, but not what came of it: is there
> a problem with just ignoring <?foo where foo is anything other than php
> or =? <?foo or <?bar or <?whatever is a parse error anyway so I very
> much doubt there's any BC break. Unless someone's program relies on
> parse errors.
>
The problem there becomes legacy support for:

<?foo();?>

And before you say "just watch for parens" there's also:

<?foo::bar();?>

and a much more insiduous example:

<?die ?>

no semicolon, no parens, no paamayim nekudotayim, nothing but a perfectly
valid looking PI tag.

-Sara

Bastian Grupe

unread,
Nov 28, 2005, 3:57:59 AM11/28/05
to
What concerns me most is that <?php= does not work, regardless if short
tags will be disabled or not in php6. I currently use <%= to counter
this, but I am most certainly *not* happy with it.

So a clean <?php= solution would be ideal, so I wouldn't have to care
about xml/xsl files parsed and neither about my templates growing too
large because of php overhead.

Marcus Boerger

unread,
Nov 28, 2005, 2:33:05 PM11/28/05
to
Hello Bastian,

id like to see '<?php=' too.

marcus


Best regards,
Marcus

Ron Korving

unread,
Nov 28, 2005, 3:28:15 PM11/28/05
to
me too, i've asked for this before but i remember it being laughed away...

ron


"Marcus Boerger" <he...@php.net> wrote in message
news:793837231.20...@marcus-boerger.de...

Matthew C. Kavanagh

unread,
Nov 27, 2005, 4:41:24 PM11/27/05
to
On Sun, 2005-11-27 at 22:32 +0100, Johannes Schlueter wrote:
> It isn't about the XML standard but about exceptions for the PHP parser and
> why should <?xml be treated different from <?jsp or <?xsl or <?foo or ...
> which all are used (hm, not sure about <?foo) and sometimes even in
> combination with PHP.

I recall this being discussed before, but not what came of it: is there


a problem with just ignoring <?foo where foo is anything other than php
or =? <?foo or <?bar or <?whatever is a parse error anyway so I very
much doubt there's any BC break. Unless someone's program relies on
parse errors.

--

Mike Hall

unread,
Nov 30, 2005, 4:32:55 AM11/30/05
to
Just FYI, the lack of <?php= is the only reason we don't disable short
tags on all development projects at my company.

Mike

On Mon, 28 Nov 2005 20:29:42 +0100
Marcus Boerger <he...@php.net> wrote:

> Hello Bastian,
>
> id like to see '<?php=' too.
>
> marcus
>
> Monday, November 28, 2005, 9:56:56 AM, you wrote:
>
> > What concerns me most is that <?php= does not work, regardless if short
> > tags will be disabled or not in php6. I currently use <%= to counter
> > this, but I am most certainly *not* happy with it.
>
> > So a clean <?php= solution would be ideal, so I wouldn't have to care
> > about xml/xsl files parsed and neither about my templates growing too
> > large because of php overhead.
>
> > Sara Golemon wrote:

> >>> I recall this being discussed before, but not what came of it: is there
> >>> a problem with just ignoring <?foo where foo is anything other than php
> >>> or =? <?foo or <?bar or <?whatever is a parse error anyway so I very
> >>> much doubt there's any BC break. Unless someone's program relies on
> >>> parse errors.
> >>>

> >> The problem there becomes legacy support for:
> >>
> >> <?foo();?>
> >>
> >> And before you say "just watch for parens" there's also:
> >>
> >> <?foo::bar();?>
> >>
> >> and a much more insiduous example:
> >>
> >> <?die ?>
> >>
> >> no semicolon, no parens, no paamayim nekudotayim, nothing but a
> >> perfectly valid looking PI tag.
> >>
> >> -Sara
>
>
>
>
> Best regards,
> Marcus
>

> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php

Mike Hall
Twist Digital Media
e. mike...@twistdigital.co.uk

D I S C L A I M E R
Statements and opinions expressed in this e-mail may not represent those
of the company.

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender immediately and delete
the material from any computer.

Hartmut Holzgraefe

unread,
Nov 30, 2005, 4:48:47 AM11/30/05
to
Mike Hall wrote:
> Just FYI, the lack of <?php= is the only reason we don't disable short
> tags on all development projects at my company.

as far as i remember the only arguemnt against <?php= was
that '=' is not a valid character for a XML processing instruction
name?


--
Hartmut Holzgraefe, Senior Support Engineer .
MySQL AB, www.mysql.com

Jason Garber

unread,
Nov 30, 2005, 12:21:13 PM11/30/05
to
Hello Mike,

Same at my company.

<?php= would be very nice.

--
Best regards,
Jason mailto:ja...@ionzoft.com

Wednesday, November 30, 2005, 4:31:58 AM, you wrote:

MH> Just FYI, the lack of <?php= is the only reason we don't disable short
MH> tags on all development projects at my company.

MH> Mike

MH> On Mon, 28 Nov 2005 20:29:42 +0100

>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php

MH> Mike Hall
MH> Twist Digital Media
MH> e. mike...@twistdigital.co.uk

MH> D I S C L A I M E R
MH> Statements and opinions expressed in this e-mail may not represent those
MH> of the company.

MH> The information transmitted is intended only for the person or entity to
MH> which it is addressed and may contain confidential and/or privileged
MH> material. Any review, retransmission, dissemination or other use of, or
MH> taking of any action in reliance upon, this information by persons or
MH> entities other than the intended recipient is prohibited. If you
MH> received this in error, please contact the sender immediately and delete
MH> the material from any computer.

Ron Korving

unread,
Nov 30, 2005, 1:06:56 PM11/30/05
to
Same for our company. We still use <? because of <?=

Ron

"Jason Garber" <ja...@ionzoft.com> wrote in message
news:522821245.20...@ionzoft.com...

Sebastian Kugler

unread,
Nov 30, 2005, 1:37:52 PM11/30/05
to
On 11/30/05, Ron Korving <r.ko...@xit.nl> wrote:
> Same for our company. We still use <? because of <?=3D

same here :-)

Would really be great if we could turn short_open_tags off and still
use the compact print syntax.

--Sebastian

Marcus Boerger

unread,
Nov 30, 2005, 3:44:21 PM11/30/05
to
Hello Hartmut,

oh, that's easy to solve '<?php' WS + '='

btw, th ejsp way is to have '<?jsp' '.' <action>

best regards
marcus

Wednesday, November 30, 2005, 10:44:37 AM, you wrote:

> Mike Hall wrote:
>> Just FYI, the lack of <?php= is the only reason we don't disable short

>> tags on all development projects at my company.

> as far as i remember the only arguemnt against <?php= was


> that '=' is not a valid character for a XML processing instruction
> name?


> --
> Hartmut Holzgraefe, Senior Support Engineer .
> MySQL AB, www.mysql.com


Best regards,
Marcus

Bart de Boer

unread,
Nov 30, 2005, 3:51:06 PM11/30/05
to
'<?php=' isn't allowed by the current W3C standards so enabling this
would brake standards compliance for PHP scripts.

If you want to be able to use '<?php=' you should go to W3C.org. There's
where the XHTML/XML specs are defined.

If people change their code from '<?' to '<?php' then, while they're at
it, they might just as well change it to '<?php echo'. It's just a teeny
little bit more code but it makes sure that your documents remain
standards compliant.

If you really don't like to use '<?php echo' and don't care about
standards compliance, I'd suggest you keep short tags enabled.


Sebastian Kugler wrote:
> On 11/30/05, Ron Korving <r.ko...@xit.nl> wrote:
>
>>Same for our company. We still use <? because of <?=
>
>

> same here :-)
>
> Would really be great if we could turn short_open_tags off and still
> use the compact print syntax.
>
> --Sebastian

--

Bart de Boer

unread,
Nov 30, 2005, 4:24:47 PM11/30/05
to
That would be a mandatory whitespace then. Which may be a bit confusing.


Marcus Boerger wrote:
> Hello Hartmut,
>
> oh, that's easy to solve '<?php' WS + '='
>
> btw, th ejsp way is to have '<?jsp' '.' <action>
>
> best regards
> marcus
>
> Wednesday, November 30, 2005, 10:44:37 AM, you wrote:
>
>
>>Mike Hall wrote:
>>
>>>Just FYI, the lack of <?php= is the only reason we don't disable short
>>>tags on all development projects at my company.
>
>
>>as far as i remember the only arguemnt against <?php= was
>>that '=' is not a valid character for a XML processing instruction
>>name?
>
>
>
>>--
>>Hartmut Holzgraefe, Senior Support Engineer .
>>MySQL AB, www.mysql.com
>
>
>
>
>
> Best regards,
> Marcus

--

Sara Golemon

unread,
Nov 30, 2005, 6:11:57 PM11/30/05
to
> oh, that's easy to solve '<?php' WS + '='
>
> btw, th ejsp way is to have '<?jsp' '.' <action>
>
Marcus-
You give me greif over ;; and ** as namespace separators then you suggest
meaningful whitespace? *tsk*tsk*tsk*
-Sara

:)

Sean Coates

unread,
Nov 30, 2005, 6:28:17 PM11/30/05
to
Sara Golemon wrote:
>> oh, that's easy to solve '<?php' WS + '='
>>
>> btw, th ejsp way is to have '<?jsp' '.' <action>
>>
> Marcus-
> You give me greif over ;; and ** as namespace separators then you
> suggest meaningful whitespace? *tsk*tsk*tsk*
> -Sara
>
> :)

Ah, but the whitespace is already meaningful (-:

sean@iconoclast:~$ echo '<?php echo"foo\n";?>' | php -d short_open_tag=0
foo
sean@iconoclast:~$ echo '<?phpecho"foo\n";?>' | php -d short_open_tag=0
<?phpecho"foo\n";?>

S

Bart de Boer

unread,
Nov 30, 2005, 6:33:51 PM11/30/05
to
But that whitespace is meaningfull at XML level and not at PHP level.

Processing Instruction: phpecho

Bart de Boer

unread,
Dec 1, 2005, 9:27:08 AM12/1/05
to

> Of course it is meaningful for PHP as well.
>

We're talking about the PHP language. Not the PHP engine. You're right that
the PHP engine needs to be capable of finding its processing instructions.
So it's capable of doing a little XML. Thus it needs to understand the
meaning of whitespace in XML.

However, that's the PHP engine doing XML syntax. Not processing PHP syntax.

It's defined in the XML spec that the end of the name of a Processing
Instruction is marked with a whitespace:

http://www.w3.org/TR/REC-xml/#sec-pi

There it states:

PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'

S meaning Whitespace.

So, that whitespace is meaningfull for XML. Not for PHP. PHP couldn't care
less how processing instructions are defined in XML.

Stefan Walk

unread,
Dec 2, 2005, 1:47:11 AM12/2/05
to
On 01/12/05, Michael Walter <michael...@gmail.com> wrote:
> Surely it ought to care iff trying to look like a processing
> instruction. But we digress...
>
> On 12/1/05, Bart de Boer <ba...@mediawave.nl> wrote:
> > So, that whitespace is meaningfull for XML. Not for PHP. PHP couldn't c=

are
> > less how processing instructions are defined in XML.
> >
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php

I could not care less if the php source code is valid xml, what
matters is the output. Anyway, if people use <?php instead of <?=3D
things are not getting worse for xml purists. Also, PHP tags are
allowed where PIs are not, and PHP code can include ?> without
problems whithout closing the PI.

Regards,
Stefan

0 new messages