Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

parse error or infinite loop? a blank screen, yet the php ..

 
   Database Forums (Home) -> PHP RSS
Next:  Writing source of a page to file  
Author Message
Lawrence Krubner

External


Since: Jun 06, 2008
Posts: 187



(Msg. 1) Posted: Mon Jun 16, 2008 9:30 pm
Post subject: parse error or infinite loop? a blank screen, yet the php error log
Archived from groups: comp>lang>php (more info?)

Imagine a template system that works by getting a file, as a string, and
then putting it through eval(), something like this:




$formAsString = $controller->command("readFileAndReturnString", $formName);


// 06-22-07 - the next commands try to import all the functions that the
form
// contains, so we don't get "Fatal Error: Undefined Function".
$arrayOfNeededFunctions =
$controller->command("matchAllPhpFunctionsInString", $formAsString);
$arrayOfTrueAndFalseResults = $controller->command("loopArray",
$arrayOfNeededFunctions, "getNeededFunctionsEach");

// 06-22-07 - (must end php or I get errors)
$phpEnd = "?";
$phpEnd .= "> ";
$formAsString = $phpEnd.$formAsString;

echo "<p>in importForm: <hr> $formAsString";

eval($formAsString);





The echo statement, which I just put there, shows the string about like
what I'd expect. Yet, on this page, I get a blank:

http://www.cyberbitten.com/my_private_page.php?formName=mp_sharing_wal...ther_pe

A blank in the middle of the page, where I am trying to import a
sub-template. Normally, if I get blank, it means that there is a parse
error in the file being included. And yet, if I ssh to the server and
examine the error log, it is empty. If I deliberately invoke an error on
another page (in this case, weblog.php), then that appears in the error
log, but no parse error does:



root@ldc310:/usr/local/bin# tail php_errors
[16-Jun-2008 20:06:42] PHP Warning: mime_magic: type regex
BEGIN[[:space:]]*[{] application/x-awk invalid in Unknown on line 0
[16-Jun-2008 20:07:03] PHP Parse error: syntax error, unexpected
T_STRING in /var/www/vhosts/cyberbitten.com/httpdocs/weblog.php on line 68
[16-Jun-2008 20:07:05] PHP Parse error: syntax error, unexpected
T_STRING in /var/www/vhosts/cyberbitten.com/httpdocs/weblog.php on line 68
[16-Jun-2008 20:07:07] PHP Parse error: syntax error, unexpected
T_STRING in /var/www/vhosts/cyberbitten.com/httpdocs/weblog.php on line 68
[16-Jun-2008 20:07:07] PHP Parse error: syntax error, unexpected
T_STRING in /var/www/vhosts/cyberbitten.com/httpdocs/weblog.php on line 68



So, what else could it be? My next thought was that it was an infinite
loop, but there are no loops on the page, only a call to my loop()
command, which has protections against infinite looping.

What would allow that string to echo to the screen, yet have the eval()
not generate anything for the screen, and there be no error in the error
log?

 >> Stay informed about: parse error or infinite loop? a blank screen, yet the php .. 
Back to top
Login to vote
Lawrence Krubner

External


Since: Jun 06, 2008
Posts: 187



(Msg. 2) Posted: Mon Jun 16, 2008 11:04 pm
Post subject: Re: parse error or infinite loop? a blank screen, yet the php error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Lawrence Krubner wrote:
>
> Imagine a template system that works by getting a file, as a string, and
> then putting it through eval(), something like this:
>
>
>
>
> $formAsString = $controller->command("readFileAndReturnString", $formName);
>
>
> // 06-22-07 - the next commands try to import all the functions that the
> form
> // contains, so we don't get "Fatal Error: Undefined Function".
> $arrayOfNeededFunctions =
> $controller->command("matchAllPhpFunctionsInString", $formAsString);
> $arrayOfTrueAndFalseResults = $controller->command("loopArray",
> $arrayOfNeededFunctions, "getNeededFunctionsEach");
>
> // 06-22-07 - (must end php or I get errors)
> $phpEnd = "?";
> $phpEnd .= "> ";
> $formAsString = $phpEnd.$formAsString;
>
> echo "<p>in importForm: <hr> $formAsString";
>
> eval($formAsString);
>
>
>
>
>
> The echo statement, which I just put there, shows the string about like
> what I'd expect. Yet, on this page, I get a blank:
>
> http://www.cyberbitten.com/my_private_page.php?formName=mp_sharing_wal...ther_pe
>
>
> A blank in the middle of the page, where I am trying to import a
> sub-template. Normally, if I get blank, it means that there is a parse
> error in the file being included. And yet, if I ssh to the server and
> examine the error log, it is empty. If I deliberately invoke an error on
> another page (in this case, weblog.php), then that appears in the error
> log, but no parse error does:
>
>
>
> root@ldc310:/usr/local/bin# tail php_errors
> [16-Jun-2008 20:06:42] PHP Warning: mime_magic: type regex
> BEGIN[[:space:]]*[{] application/x-awk invalid in Unknown on line 0
> [16-Jun-2008 20:07:03] PHP Parse error: syntax error, unexpected
> T_STRING in /var/www/vhosts/cyberbitten.com/httpdocs/weblog.php on line 68
> [16-Jun-2008 20:07:05] PHP Parse error: syntax error, unexpected
> T_STRING in /var/www/vhosts/cyberbitten.com/httpdocs/weblog.php on line 68
> [16-Jun-2008 20:07:07] PHP Parse error: syntax error, unexpected
> T_STRING in /var/www/vhosts/cyberbitten.com/httpdocs/weblog.php on line 68
> [16-Jun-2008 20:07:07] PHP Parse error: syntax error, unexpected
> T_STRING in /var/www/vhosts/cyberbitten.com/httpdocs/weblog.php on line 68
>
>
>
> So, what else could it be? My next thought was that it was an infinite
> loop, but there are no loops on the page, only a call to my loop()
> command, which has protections against infinite looping.
>
> What would allow that string to echo to the screen, yet have the eval()
> not generate anything for the screen, and there be no error in the error
> log?



Okay, I worked it out. I was using double quotes inside of double quotes
inside of the PHP code, in an SQL query. A stupid mistake. But I am
surprised that when I called eval() on this string, no error appeared in
the PHP error log. Instead, I solved this problem by finding the last
working version of this file in Subversion, and comparing it to the
first non-working version of the file. Then my mistake jumped out at me.
Thank god for Subversion.

 >> Stay informed about: parse error or infinite loop? a blank screen, yet the php .. 
Back to top
Login to vote
AnrDaemon

External


Since: Oct 17, 2007
Posts: 77



(Msg. 3) Posted: Tue Jun 17, 2008 12:56 pm
Post subject: Re: parse error or infinite loop? a blank screen, yet the php error log is empty [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Greetings, Lawrence Krubner.
In reply to Your message dated Tuesday, June 17, 2008, 07:04:51,

> the PHP error log. Instead, I solved this problem by finding the last
> working version of this file in Subversion, and comparing it to the
> first non-working version of the file. Then my mistake jumped out at me.
> Thank god for Subversion.

Get a good editor with syntax highlighting.
Then your mistake will just light through the code till you find and kill it.


--
Sincerely Yours, AnrDaemon
 >> Stay informed about: parse error or infinite loop? a blank screen, yet the php .. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Parse error - Hi, What's wrong with this line? I'm getting parse errors for it: if ( empty($payment) || !is_numeric($payment) ) {

Parse error: parse error, unexpected T_STRING, expecting '.. - I'm getting the following error on this line, (last, first, address) VALUES('$last', '$first', '$address' ) ") Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/xxxxxx/public_html/process1.php on line 22 I copied the co...

Infinite Script - I need to make a script that whenever somethin is added to the db, it will run and grab those info. Worth sayin that there's no time limit for the db data addition. I was planning of makin a script that runs infinitly every 0.25 seconds and break then..

parse XML into mysql - Hi i have an XML like this: <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> <parlast modified="20/06/2008 12:03"> <nodo name="test" nodoid="3893"> ...

text file displaying on screen -
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]