473,749 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("readF ileAndReturnStr ing", $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".
$arrayOfNeededF unctions =
$controller->command("match AllPhpFunctions InString", $formAsString);
$arrayOfTrueAnd FalseResults = $controller->command("loopA rray",
$arrayOfNeededF unctions, "getNeededFunct ionsEach");

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

echo "<p>in importForm: <hr$formAsStrin g";

eval($formAsStr ing);

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 3226
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("readF ileAndReturnStr ing", $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".
$arrayOfNeededF unctions =
$controller->command("match AllPhpFunctions InString", $formAsString);
$arrayOfTrueAnd FalseResults = $controller->command("loopA rray",
$arrayOfNeededF unctions, "getNeededFunct ionsEach");

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

echo "<p>in importForm: <hr$formAsStrin g";

eval($formAsStr ing);

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*******@free mail.ru>

Jun 27 '08 #3

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

Similar topics

2
1955
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. The intention is that if any of the two form fields are blank (empty) then the page is resent stating that they have to fill in all the fields to post (to a database). If I deliberately leave the fields blank and submit the form, querying the...
3
3099
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 function) Mozilla/FireFox/Netscape causes the browser to go into an infinite loop, apparently attempting to reload the page. ie: <script type="text/javascript">
21
2669
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; }; forwarders { 4.2.2.2; }; };
2
4442
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 then skip this file and move onto the next file (line). If file is there then move to a sirectory. Here is the code I have (Feel free to make corrections as needed. If possible make changes in red)
9
6874
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 method on the specified URL, and then, within the DocumentComplete event, parsing the HTML page using mshtml.HTMLDocument. I'm writing it as a console app because I don't need to display the HTML, just search for a specific tag and retrieve a href...
16
5880
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 with the following elements arr(0) = "MyString" arr(1) = 40 arr(2) = "Hello world"
1
1397
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 instance.) Any idea why the WAP client will work with some phones but give this infinite loop error with others? Thanks, -SJ
59
79796
by: rami | last post by:
please everybody ,can anyone tell me how to do an infinite loop in C
3
5065
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, unexpected T_VARIABLE in /home/content/m/i/x/mixxsalon/html/FormToEmail.php on line 1 here is the code. <?php $my_email = "user@example.com"; /*
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.