473,230 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

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


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_privat...ples_posts.htm

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?


Jun 27 '08 #1
2 3189
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_privat...ples_posts.htm
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.

Jun 27 '08 #2
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 <an*******@freemail.ru>

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dariusz | last post by:
I have a small form that on button press submits to a PHP file for further processing into a database. I have to change the script as it allows blank / nothing to be submitted to the database. ...
3
by: Stewart | last post by:
Dear javascripters, Through a frustrating afternoon of debugging I appear to have discovered something: Setting location.hash to an empty string in the global namespace (not inside a...
21
by: William Stacey [MVP] | last post by:
Anyone know of some library that will parse files like following: options { directory "/etc"; allow-query { any; }; // This is the default recursion no; listen-on { 192.168.0.225;...
2
by: Keith Kowalski | last post by:
I anm opening up a text file reading the lines of the file that refer to a tif image in that file, If the tif image does not exist I need it to send an email stating that the file doesn't exist...
9
by: John Williams | last post by:
How do I load a HTML page (via URL) and parse the DOM in a Console Application? I've successfully done all this in a Windows Application by using the WebBrowser control, calling the Navigate...
16
by: Charles Law | last post by:
I have a string similar to the following: " MyString 40 "Hello world" all " It contains white space that may be spaces or tabs, or a combination, and I want to produce an array...
1
by: SJ | last post by:
I'm developing a WAP client which presently works fine on most mobile phone browsers, but gives me an Infinite loop error (error 1025) when i try to access it from a couple of phones(motorola for...
59
by: rami | last post by:
please everybody ,can anyone tell me how to do an infinite loop in C
3
by: broll911 | last post by:
I am gettin a error message on this script can someone help me. I am a complete newbie on this stuff. Thanks in advance for any help you can give me. here is the error. Parse error: syntax error,...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.