Page 1 of 1

echo statement doesn't work

Posted: Mon May 28, 2007 11:11 pm
by noelswanson
There is something very bizarre going on here - but I don't know where to start in trying to figure this out.

I have a script that was working fine in the past. Now it dies. but here is the strange thing:

It dies at various different points depending on what I do with the echo statements. For example if I have this:


Code: Select all

print "<br>url: ";
print $url;
It is fine (but dies later on)

If i have this:

Code: Select all

print "<br>url: ".$url;
It dies on that line.

When I say it dies later on, I mean it dies on some other statement further down. For example, in this line, it dies half way through:

Code: Select all

if($value!="not used")if($hidden!="")$update=$update.',`hidden`=\''.$hidden.'\'';
how do I know? Because if I break that down into parts, it dies on the first letter d:

Code: Select all

if($value!="not used"){
 echo "if 1<br>\n";
 if($hidden!=""){
  echo "if 2, ".strlen($update)."<br>\n";
  $update.="";
  echo "if 2a<br>\n";
  $update.=",";
  echo "if 2a ,<br>\n";
  $update.="h";
  echo "if 2a h<br>\n";
  $update.="i";
  echo "if 2a i<br>\n";
  $update.="d";
  echo "if 2a d<br>\n";
  $update.="d";
  echo "if 2a d<br>\n";
  $update.="e";
  echo "if 2a e<br>\n";
  $update.="n";
  echo "if 2b<br>\n";
  $update.='=\'';
  echo "if 2c<br>\n";
  $update.=$hidden.'\'';
  echo "if 2d<br>\n";
  }
 echo "if 1b<br>\n";
 }
None of this makes any logical sense at all, so can anyone shed any light on what on Earth is going on? This is on my own dedicated server, ... hmm, just tried to run phpinfo(), but the script died at that point:

Code: Select all

print_r($tags);
print "hello";
phpinfo();
So I put it at the beginning, and it worked.

so - php 5.2.1 on apache/linux

in total it is a very simple script, nothing complicated, dies at around line 95.

Any ideas?

Thanks

Noel

Posted: Mon May 28, 2007 11:24 pm
by feyd
Does $url exist at the point where it fails?

It's fairly difficult to know how to fix things without seeing more of your code, I suspect.

Posted: Tue May 29, 2007 12:35 am
by s.dot
My very non-educated guess would be that you're going in and out of full tags (<?php) and short tags (<?) on a php installation that doesn't allow short tags. That often causes very weird results.

Posted: Tue May 29, 2007 11:00 am
by RobertGonzalez
scottayy wrote:My very non-educated guess would be that you're going in and out of full tags (<?php) and short tags (<?) on a php installation that doesn't allow short tags. That often causes very weird results.
That's what I was thinking.