think tank forum

technology » do php short open tags break xml?

lucas's avatar
14 years ago
link
lucas
i ❤ demo
no.

--

normally, one uses "<?php" to start php code. one uses "<?xml" to start an xml document.

so if one turns on php short open tags ("<?"), will that break the xml documents? no.

presumably because php also looks for the space. so php will match "<? xml" but not "<?xml". or in regexp language, php matches #<[\?] #, not #<[\?]#.

--

ref: me on a blog
bsdlite's avatar
14 years ago
link
bsdlite
thinks darkness is his ally
clever girl
lucas's avatar
14 years ago
link
lucas
i ❤ demo
well, it was reported as a bug that the php project won't fix in 4.3.2. so at some point it was a problem, but now it's fine. i guess they decided to fix it since then.
lucas's avatar
14 years ago
link
lucas
i ❤ demo
> clever girl

girl? larz is a boy
phi_'s avatar
14 years ago
link
phi_
... and let the Earth be silent after ye.
Jurassic Park reference.
bsdlite's avatar
14 years ago
link
bsdlite
thinks darkness is his ally
^
dannyp's avatar
14 years ago
link
dannyp
dʎuuɐp
http://www.youtube.com/watch?v=dFUlAQZB9Ng
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
Isn't short_open_tag off by default in PHP 5.3+? IIRC it's going to be removed completely in PHP 6.
Chiken's avatar
14 years ago
link
Chiken
Don't Let Your Walls Down
i was under the impression it was going to be removed
lucas's avatar
14 years ago
link
lucas
i ❤ demo
> Isn't short_open_tag off by default in PHP 5.3+?

probably. but even when i enable it, it handles #<[\?]xml# gracefully.
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
Right. I always use the print '<?xml ...'; out of habit anyway ... Never hurts to be compatible with older php versions ...