Jump to content

PHP echo strange behavior


flaab

Recommended Posts

Hi,

 

I have a really strange problem in a production server and  I don't know what it is. I'm going nuts.

 

I'm programming a HTML newsletter that is saved into he hard drive and sent by mail. So, the HTML code must be created dinamically.

 

Take a look at the following (simplified) code. Basically, it grabs an array of strings and displays an image for each one of them.

 

 
// Iteramos parrafos poniendo fotos si tenemos
for($it = 0; $it < count($parrafos); $it++)
{
     // El parrafo debe ser mas alrgo que 3 caracteres
     if(strlen($parrafos[$it]) > 2)
     {
           // Si tenemos foto para este parrafo
           if(isset($imagenes[$image_it]))
           {
                 $cuerpo_final .= '<img width="80" src="http://www.ecoturismorural.com';
                 $cuerpo_final .= $imagenes[$image_it];
                 $cuerpo_final .= '" />';
                 $image_it++;
            }
                        
             // Ponemos parrafo
             $cuerpo_final .= "\n<p>". $parrafos[$it] ."</p>\n";
     }
}

 

The created string is not modified at any time before being printed on the screen. And the local output is the following:

 

<img width="80" src="http://www.ecoturismorural.com/img/Parrafos/File/IMG_0161.JPG" />
<p>Durante la semana del 26 al 30 de Mayo un grupo ... (more text)</p>

<img width="80" src="http://www.ecoturismorural.com/img/Parrafos/File/IMG_0166.JPG" />
<p>El programa "Galicia Natural" tiene como objetivo ... (more text)</p>

 

That will be the correct output.

 

The problem is...the same script executed on the production machine outputs other thing completely!

 

- Domain names are removed from all URLS

- Characters < > and " are trasnslated into html entities

- Image outputs are surrounded by <p> and </p>

 

All these all by its own! :s

 

<p><img src="img/Establecimientos_Mini/4385La%20Monta%F1eta%201.JPG"></p>
<p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed lorem ... (more text)</p>

<p><img src="img/Establecimientos_Mini/64266.jpg"></p>
<p>Class aptent taciti sociosqu ad litora torquent per ... (more text)</p>

 

And it's just he same echo(). I would really appreciate any help!

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/118235-php-echo-strange-behavior/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.