Strange PHP behavior

software development

#1

Hi,

I’m getting a non-comform output behavior with quotes when executing PHP scripts on DreamHost server (PHP 5.3 FastCGI).

Here is an example:
[php]<?php
echo ‘

’;
echo “

$title

”;
echo “

$title

”;
echo ‘
’;
?>[/php]

It outputs this line:

As we can see, the first “class” propriety, with only one term (“foo”), lost its quotes, the second, with two terms, and even the “style” propriety, didn’t. This generates acceptable HTML code, but illegal XHTML.

Why does it happens? This goes against any PHP documentation.

I’ve turned off any “magic_quotes”, and they act just in incoming strings, not during output.

Strangely enough, sometimes the script runs correctly, without dropping the quotes. This behavior seems to be unpredictable.

Do you have any idea about what is causing it?

thanks!,
Caio


#2

Are you using mod_pagespeed? That’ll make some changes to HTML like the ones you’re observing. Disable it if you don’t want that to happen.


#3

Yes! You’re right: http://code.google.com/intl/pt-BR/speed/page-speed/docs/filter-quote-remove.html.

I’ve activated “Page Speed Optimization” in domain management interface because I thought it was only a diagnosis tool! I should have read more carefully!

Thank you!