473,800 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unexpected }

I have a 638 line glob of PHP code & HTML that won't run.
I get "PHP Parse error: syntax error, unexpected '}' in quiz\\quiz.php
on line 594".
I wrote a brace checker that checks perens, square brackets, and curly
braces for mismatches & opens and it checks out perfect. so I don't
know what it is about the curly brace error. it's false.
anybody have a clue as to what the real error might be? the code looks
pristine to me.

------------------------------------
Jim Michaels
for email, edit the address

"Because we do not understand the brain very well we are constantly
tempted to use the latest technology as a model for trying to understand
it. In my childhood we were always assured that the brain was a
telephone switchboard. ('What else could it be?') I was amused to see
that Sherrington, the great British neuroscientist, thought that the
brain worked like a telegraph system. Freud often compared the brain to
hydraulic and electro-magnetic systems. Leibniz compared it to a mill,
and I am told some of the ancient Greeks thought the brain functions
like a catapult. At present, obviously, the metaphor is the digital
computer." - John R Searls.
Nov 19 '07
20 3171
On Thu, 22 Nov 2007 00:15:13 +0100, Oliver Grätz <ol***********@ gmx.de>
wrote:
Rik Wasmus schrieb:
>Allthough it's a big nono to post attachments, a quick look learns me I
will unfortunatly not check this code. This is truly a maintenance
nightmare. Templates and/or isolating some deeply nested
if/else/while/switch statements seems to be badly needed.

A "php -l" did not yield a parsing error AND the file is 692 lines long
(not 638) AND it is not matching the filename from the error message, so
I doubt the file in question was attached...
Hmmm, don't know where something went different, a php -l here gave me a:
Parse error: syntax error, unexpected '}' in G:\Personal\qui ztaker.php on
line 648
--
Rik Wasmus
Nov 21 '07 #11
Rik Wasmus schrieb:
>A "php -l" did not yield a parsing error AND the file is 692 lines long
(not 638) AND it is not matching the filename from the error message, so
I doubt the file in question was attached...

Hmmm, don't know where something went different, a php -l here gave me a:
Parse error: syntax error, unexpected '}' in G:\Personal\qui ztaker.php on
line 648
# php4 -v
PHP 4.4.7-0.dotdeb.0 with Suhosin-Patch 0.9.6 (cli) (built: May 9 2007
16:38:02)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

# php4 -l quiztaker.php
No syntax errors detected in quiztaker.php

# php -v
PHP 5.2.5-0.dotdeb.0 with Suhosin-Patch 0.9.6.2 (cli) (built: Nov 12
2007 19:09:20)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

# php -l quiztaker.php
No syntax errors detected in quiztaker.php
php -v
PHP 5.2.1 (cli) (built: Feb 7 2007 23:11:26)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Xdebug v2.0.0, Copyright (c) 2002, 2003, 2004, 2005, 2006,
2007, by Derick Rethans
>php -l quiztaker.php
No syntax errors detected in quiztaker.php
No problems here, not with PHP4 nor PHP5, and not on win32.
I even changed the file from CR+LF to just LF, no change.
Have to mark this as WORKSFORME ;-)

OLLi

--
Programming is an art form that fights back.
Nov 22 '07 #12
On Thu, 22 Nov 2007 02:09:23 +0100, Oliver Grätz <ol***********@ gmx.de>
wrote:
Rik Wasmus schrieb:
>>A "php -l" did not yield a parsing error AND the file is 692 lines long
(not 638) AND it is not matching the filename from the error message,
so
I doubt the file in question was attached...

Hmmm, don't know where something went different, a php -l here gave me
a:
Parse error: syntax error, unexpected '}' in G:\Personal\qui ztaker.php
on
line 648
PHP 4.4.7-0.dotdeb.0 with Suhosin-Patch 0.9.6 (cli) (built: May 9 2007
16:38:02)
No syntax errors detected in quiztaker.php
PHP 5.2.5-0.dotdeb.0 with Suhosin-Patch 0.9.6.2 (cli) (built: Nov 12
2007 19:09:20)
No syntax errors detected in quiztaker.php
PHP 5.2.1 (cli) (built: Feb 7 2007 23:11:26)
No syntax errors detected in quiztaker.php
No problems here, not with PHP4 nor PHP5, and not on win32.
I even changed the file from CR+LF to just LF, no change.
Have to mark this as WORKSFORME ;-)
Win64,
PHP 5.2.4 (cli) (built: Aug 30 2007 07:06:31),
Parse error: syntax error, unexpected '}' in quiztaker.php on line 648

Weird....
--
Rik Wasmus
Nov 22 '07 #13
On Thu, 22 Nov 2007 02:35:29 +0100, Rik Wasmus
<lu************ @hotmail.comwro te:
On Thu, 22 Nov 2007 02:09:23 +0100, Oliver Grätz <ol***********@ gmx.de>
wrote:
>Rik Wasmus schrieb:
>>>A "php -l" did not yield a parsing error AND the file is 692 lines
long
(not 638) AND it is not matching the filename from the error message,
so
I doubt the file in question was attached...

Hmmm, don't know where something went different, a php -l here gave me
a:
Parse error: syntax error, unexpected '}' in G:\Personal\qui ztaker.php
on
line 648
>PHP 4.4.7-0.dotdeb.0 with Suhosin-Patch 0.9.6 (cli) (built: May 9 2007
PHP 5.2.5-0.dotdeb.0 with Suhosin-Patch 0.9.6.2 (cli) (built: Nov 12
PHP 5.2.1 (cli) (built: Feb 7 2007 23:11:26)
No syntax errors detected in quiztaker.php

No problems here, not with PHP4 nor PHP5, and not on win32.
I even changed the file from CR+LF to just LF, no change.
Have to mark this as WORKSFORME ;-)

Win64,
PHP 5.2.4 (cli) (built: Aug 30 2007 07:06:31),
Parse error: syntax error, unexpected '}' in quiztaker.php on line 648

Weird....
md5_file() =f0fa03b6e3479c 5f45ff6f0174ad3 78d
Yours?
--
Rik Wasmus
Nov 22 '07 #14
Rik Wasmus schrieb:
>Win64,
PHP 5.2.4 (cli) (built: Aug 30 2007 07:06:31),
Parse error: syntax error, unexpected '}' in quiztaker.php on line 648

Weird....

md5_file() =f0fa03b6e3479c 5f45ff6f0174ad3 78d
Yours?
>php -r "echo md5_file('quizt aker.php')";
f0fa03b6e3479c5 f45ff6f0174ad37 8d

Nope, we're shoveling the same coals into the engine...

And I can even get some HTML output from the script after changing the
top of the file to

<?php
function getconfigvar() {return '';}
$_SESSION['minutes']=(int)(ini_get( "session.gc_max lifetime")/60);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
// now the rest follows...

so this is no fake OK message. It reallys seems to have something to do
with some very subtle differences in the PHP version or configuration.
Hard to catch, giving up...

OLLi

--
public class ValidationMessa ge
{
//internal members
string messageId;
string messageText;
string helpLink;
/* ... */
double cheeseburger;
char broiled;
long time;

//helper functions
/* ... */
}
Nov 22 '07 #15
Oliver Grätz wrote:
Rik Wasmus schrieb:
>>Win64,
PHP 5.2.4 (cli) (built: Aug 30 2007 07:06:31),
Parse error: syntax error, unexpected '}' in quiztaker.php on line 648

Weird....
md5_file() =f0fa03b6e3479c 5f45ff6f0174ad3 78d
Yours?
>php -r "echo md5_file('quizt aker.php')";
f0fa03b6e3479c5 f45ff6f0174ad37 8d

Nope, we're shoveling the same coals into the engine...

And I can even get some HTML output from the script after changing the
top of the file to

<?php
function getconfigvar() {return '';}
$_SESSION['minutes']=(int)(ini_get( "session.gc_max lifetime")/60);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
// now the rest follows...

so this is no fake OK message. It reallys seems to have something to do
with some very subtle differences in the PHP version or configuration.
Hard to catch, giving up...

OLLi
Remember, when you include the file, it's effectively the same as
copying/pasting the source into the file. IOW, a syntax error (i.e. an
unmatched '"'( can be carried over into the included file.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 22 '07 #16
Oliver Grätz wrote:
Jim Michaels schrieb:
>>>I have a 638 line glob of PHP code & HTML that won't run.
I get "PHP Parse error: syntax error, unexpected '}' in
quiz\\quiz.p hp on line 594".

Your attachment won't help, the error is not in quiztaker.php but in
quiz.php,

OLLi



I renamed it. I also added more commented-out code.

--

------------------------------------
Jim Michaels
for email, edit the address

"Because we do not understand the brain very well we are constantly
tempted to use the latest technology as a model for trying to understand
it. In my childhood we were always assured that the brain was a
telephone switchboard. ('What else could it be?') I was amused to see
that Sherrington, the great British neuroscientist, thought that the
brain worked like a telegraph system. Freud often compared the brain to
hydraulic and electro-magnetic systems. Leibniz compared it to a mill,
and I am told some of the ancient Greeks thought the brain functions
like a catapult. At present, obviously, the metaphor is the digital
computer." - John R Searls.
Nov 23 '07 #17
Jerry Stuckle wrote:
Oliver Grätz wrote:
>Rik Wasmus schrieb:
>>>Win64,
PHP 5.2.4 (cli) (built: Aug 30 2007 07:06:31),
Parse error: syntax error, unexpected '}' in quiztaker.php on line 648

Weird....
md5_file() =f0fa03b6e3479c 5f45ff6f0174ad3 78d
Yours?
>>php -r "echo md5_file('quizt aker.php')";
f0fa03b6e3479c 5f45ff6f0174ad3 78d

Nope, we're shoveling the same coals into the engine...

And I can even get some HTML output from the script after changing the
top of the file to

<?php
function getconfigvar() {return '';}
$_SESSION['minutes']=(int)(ini_get( "session.gc_max lifetime")/60);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
// now the rest follows...

so this is no fake OK message. It reallys seems to have something to do
with some very subtle differences in the PHP version or configuration.
Hard to catch, giving up...

OLLi

Remember, when you include the file, it's effectively the same as
copying/pasting the source into the file. IOW, a syntax error (i.e. an
unmatched '"'( can be carried over into the included file.
when I edited in dreamweaver 8 I don't think I saw any strings out of place.
I am using 3 different versions of PHP. PHP4 & PHP5 from XAMPP, PHP
5.2.3 CLI win32. ALL fail. all have warnings and errors set to full
blast. with XAMPP, all errors are fed into apache/error.log.

I get some HTML, but it's essentially <body></bodywith nothing in
between. the basic HTML page. I also get an error message about the
curly brace in the error log.
with the win32 version I get the error message straignt out on the
command-line.
I'll try removing sections under a different filename and see what happens.
------------------------------------
Jim Michaels
Nov 23 '07 #18
Jim Michaels wrote:
Jerry Stuckle wrote:
>Oliver Grätz wrote:
>>Rik Wasmus schrieb:
Win64,
PHP 5.2.4 (cli) (built: Aug 30 2007 07:06:31),
Parse error: syntax error, unexpected '}' in quiztaker.php on line 648
>
Weird....
md5_file() =f0fa03b6e3479c 5f45ff6f0174ad3 78d
Yours?

php -r "echo md5_file('quizt aker.php')";
f0fa03b6e3479 c5f45ff6f0174ad 378d

Nope, we're shoveling the same coals into the engine...

And I can even get some HTML output from the script after changing the
top of the file to

<?php
function getconfigvar() {return '';}
$_SESSION['minutes']=(int)(ini_get( "session.gc_max lifetime")/60);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
// now the rest follows...

so this is no fake OK message. It reallys seems to have something to do
with some very subtle differences in the PHP version or configuration.
Hard to catch, giving up...

OLLi

Remember, when you include the file, it's effectively the same as
copying/pasting the source into the file. IOW, a syntax error (i.e.
an unmatched '"'( can be carried over into the included file.

when I edited in dreamweaver 8 I don't think I saw any strings out of
place.
I am using 3 different versions of PHP. PHP4 & PHP5 from XAMPP, PHP
5.2.3 CLI win32. ALL fail. all have warnings and errors set to full
blast. with XAMPP, all errors are fed into apache/error.log.

I get some HTML, but it's essentially <body></bodywith nothing in
between. the basic HTML page. I also get an error message about the
curly brace in the error log.
with the win32 version I get the error message straignt out on the
command-line.
I'll try removing sections under a different filename and see what happens.
------------------------------------
Jim Michaels
Which says you have a basic syntax error.

Don't trust Dreamweaver (or any other editor) to do your work for you.
They all can make mistakes. And ultimately, YOU are responsible for the
code.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 24 '07 #19
Jim Michaels wrote:
<?php
include 'header.php';
$_SESSION['minutes']=(int)(ini_get( "session.gc_max lifetime")/60);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
...blah...</head>

<body>
<div class="heading" >Quiz</div>
<?php
//must have just typed in the URL.
if (!isset($_SESSI ON['uid']) && !isset($_SESSIO N['battery_id'])) {
?>
<br /><!--needed because of padding in span -->
<span class="needacco unt">You need to register before you can take a
test.</span><br />
<br />
<a href="userlogin .php">Login</a><br />
<a href="ucreateac ct.php">Registe r</a><br />
<?
and there's the culprit. <? instead of <?php
I knew it was not a bracket or quote problem. dreamweaver covers quotes
by making mistakes very visible. the tool I wrote covers brackets. but
dw is supposed to handle generic PHP code, therefore it displays <? the
same as <?PHP. I think this should be an option, because it could make
the difference between your code running or not running - not every
server has short_tags enabled.

and after running the code with the session variables in place, I find
it is still quite buggy due to discovering something very important
missing... time for a rewrite/rethink. ugh. what was I thinking?

anyway, thanks for the help. I wouldn't have gotten this far without a
2nd pair of eyes. thanks again.
------------------------------------
Jim Michaels
for email, edit the address
Nov 24 '07 #20

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

Similar topics

0
4247
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version of MySQL 5.0? When trying to connect I am getting: ** BEGIN NESTED EXCEPTION **
1
1862
by: Ken | last post by:
Any thoughts on making explicit calls to unexpected()? My sense is that this function is really intended to be invoked automatically as part of exception handling. Are there times when explicit calls would be useful? Or would doing so introduce bug risks or maintanance headaches unnecessarily? Thanks for any opinions! Ken
3
2863
by: Teddy | last post by:
Hello all According to "Think in C++ Volume2", the code below should run smoothly: #include <iostream> #include <exception> using namespace std; class ex { };
2
2172
by: Gerhard Esterhuizen | last post by:
Hi, I am observing unexpected behaviour, in the form of a corrupted class member access, from a simple C++ program that accesses an attribute declared in a virtual base class via a chain of virtual method calls. To further complicate (or perhaps simplify) matters, some compilers (GCC and MingW) produce the expected behaviour, while others (MSVS 7.1) do not. I can only offer two explanations for my observations: 1. The Microsoft...
3
7426
by: Eric Anderson Vianet SAO | last post by:
hello all When i tried ´pg_dump -v -f dump.dmp dtbtransporte´ I got the error: pg_dump: restoring data for table tbdmovimento pg_dump: dumping out the contents of table tbdmovimento pg_dump: ERROR: unexpected chunk number 8 (expected 0) for toast value 6935693
5
24776
by: Vijayakrishna Pondala | last post by:
Hi, We are using the following error randomly, when accessing a webservice method/servlet hosted on JBoss application server: The underlying connection was closed: An unexpected error occurred on a receive. We are using .NET v1.1.
5
4520
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by including the -q64 option in xlC compiler. And we are able to link all these libraries to one of the main applications and generate an executable. SKLoader. But, when we try to run this main executable, we are getting the following errors:
8
2817
by: Jim Michaels | last post by:
C:\prj\quiz\withusers>php tareports.php PHP Parse error: syntax error, unexpected T_ELSE in C:\prj\quiz\withusers\tareports.php on line 205 this is the section of code. if (isset($row4)) { if (isset($row5)) { //answer given? if ($row4==$row5) {
3
3321
by: Anup Daware | last post by:
Hi Group, I am facing a strange problem here: I am trying to read xml response from a servlet using XmlTextWriter. I am able to read the read half of the xml and suddenly an exception: “Unexpected end of file while parsing Name has occurred†isbeing thrown. Following is the part o xml I am trying to read: <CHECK_ITEM_OUT>
13
3621
by: bintom | last post by:
I ran the following simple code in C++ and got unexpected results: float f = 139.4; cout << f; Output: 139.399994;
0
9691
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
9551
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
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9092
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...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6815
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();...
1
4150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3765
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.