unexpected }

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Michaels

    #1

    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.
  • Sanders Kaufman

    #2
    Re: unexpected }

    "Jim Michaels" <jmichae3REMOVE @THISPLEASEyaho o.comwrote in message
    news:FdCdnTMkRq Msv9zanZ2dnUVZ_ q-jnZ2d@comcast.c om...
    >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.
    It does appear, from that description, that the error is in error.
    But, just on a lark, look to see if you have "{$" inside a string somewhere.
    Curly bracket followed by a dollar sign tells PHP that it's a complex,
    inline variable.
    So, if you that, it could produce the error you describe, without raising
    the alarm with your bracket-checker.





    >
    ------------------------------------
    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
    puter." - John R Searls.

    Comment

    • Jerry Stuckle

      #3
      Re: unexpected }

      Jim Michaels wrote:
      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.
      >
      Jim,

      Obviously there's a mismatch somewhere :-). Did your brace checker
      ignore braces within strings? Or within comments? Either one can throw
      it off.

      Try a editor with syntax highlighting. On Windows I recommend Crimson;
      it has the added advantage of matching up braces for you.


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

      Comment

      • Rik Wasmus

        #4
        Re: unexpected }

        On Mon, 19 Nov 2007 06:44:14 +0100, Jim Michaels
        <jmichae3REMOVE @THISPLEASEyaho o.comwrote:
        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.
        An unexpected '}' doesn't mean that curly brace should not be there. For
        me, most of the time I get this it means the previous expression wasn't
        finished (missing ')' or ';'). If you'd have posted you code leading up to
        the offending brace at line 594 maybe we could spot it...
        --
        Rik Wasmus

        Comment

        • Jim Michaels

          #5
          Re: unexpected }

          Jerry Stuckle wrote:
          Jim Michaels wrote:
          >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".
          >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.
          >>
          >
          Jim,
          >
          Obviously there's a mismatch somewhere :-). Did your brace checker
          ignore braces within strings? Or within comments? Either one can throw
          it off.
          >
          Try a editor with syntax highlighting. On Windows I recommend Crimson;
          it has the added advantage of matching up braces for you.
          >
          >
          it ignores within comments. and as I said, braces match.

          --

          ------------------------------------
          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.

          Comment

          • FFMG

            #6
            Re: unexpected }


            Jim Michaels;104397 Wrote:
            >
            it ignores within comments. and as I said, braces match.
            >
            Well, sorry, but obviously they don't.
            I'd like to think that php has its braces covered by now.

            Without seen the code it is very hard to tell where there is a
            mismatch.
            We don't even know you brace checking code, there could also be a
            problem in that.

            FFMG.


            --

            'webmaster forum' (http://www.httppoint.com) | 'Free Blogs'
            (http://www.journalhome.com/) | 'webmaster Directory'
            (http://www.webhostshunter.com/)
            'Recreation Vehicle insurance'
            (http://www.insurance-owl.com/other/car_rec.php) | 'Free URL
            redirection service' (http://urlkick.com/)
            ------------------------------------------------------------------------
            FFMG's Profile: http://www.httppoint.com/member.php?userid=580
            View this thread: http://www.httppoint.com/showthread.php?t=22375

            Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).

            Comment

            • Rik Wasmus

              #7
              Re: unexpected }

              On Tue, 20 Nov 2007 06:26:15 +0100, Jim Michaels
              <jmichae3REMOVE @THISPLEASEyaho o.comwrote:
              Rik Wasmus wrote:
              If you'd have posted you code leading up
              >to the offending brace at line 594 maybe we could spot it...
              I need a 2nd pair of eyes on this problem.
              Guess what? We do need the lines to see...

              (And thanks for the correct sig seperator BTW :) )
              --
              Rik Wasmus

              Comment

              • =?ISO-8859-15?Q?Oliver_Gr=E4tz?=

                #8
                Re: unexpected }

                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.ph p on line 594".
                Your attachment won't help, the error is not in quiztaker.php but in
                quiz.php,

                OLLi


                --
                Cordy: "I think it - I say it. It's my way."
                [Angel 107]

                Comment

                • Rik Wasmus

                  #9
                  Re: unexpected }

                  On Wed, 21 Nov 2007 20:13:45 +0100, Oliver Grätz <oliver.graetz@ gmx.de>
                  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,
                  Ah, an attachment, that's why there was no code in the post. As this group
                  hasn't got 'binary' or 'binaries' in its name it didn't even occur to
                  check to me to check for that :).

                  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.
                  --
                  Rik Wasmus

                  Comment

                  • =?ISO-8859-15?Q?Oliver_Gr=E4tz?=

                    #10
                    Re: unexpected }

                    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...

                    Your remarks about isolating are right. Just take out inner blocks until
                    the error message fades away. Go back one step and find the error
                    position...

                    OLLi

                    --
                    "My urination just hasn't been public enough lately."
                    [Cordelia in Angel 105]

                    Comment

                    • Rik Wasmus

                      #11
                      Re: unexpected }

                      On Thu, 22 Nov 2007 00:15:13 +0100, Oliver Grätz <oliver.graetz@ 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

                      Comment

                      • =?ISO-8859-15?Q?Oliver_Gr=E4tz?=

                        #12
                        Re: unexpected }

                        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.

                        Comment

                        • Rik Wasmus

                          #13
                          Re: unexpected }

                          On Thu, 22 Nov 2007 02:09:23 +0100, Oliver Grätz <oliver.graetz@ 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

                          Comment

                          • Rik Wasmus

                            #14
                            Re: unexpected }

                            On Thu, 22 Nov 2007 02:35:29 +0100, Rik Wasmus
                            <luiheidsgoeroe @hotmail.comwro te:
                            On Thu, 22 Nov 2007 02:09:23 +0100, Oliver Grätz <oliver.graetz@ 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

                            Comment

                            • =?ISO-8859-15?Q?Oliver_Gr=E4tz?=

                              #15
                              Re: unexpected }

                              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
                              /* ... */
                              }

                              Comment

                              Working...