unexpected }

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Stuckle

    #16
    Re: unexpected }

    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.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Jim Michaels

      #17
      Re: unexpected }

      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.

      Comment

      • Jim Michaels

        #18
        Re: unexpected }

        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

        Comment

        • Jerry Stuckle

          #19
          Re: unexpected }

          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.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Jim Michaels

            #20
            Re: unexpected }

            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

            Comment

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

              #21
              Re: unexpected }

              Jim Michaels schrieb:
              >
              anyway, thanks for the help. I wouldn't have gotten this far without a
              2nd pair of eyes. thanks again.
              I tried a lot but in the end you had to find it yourself. Sorry, but I
              couldn't make the database calls for you without a copy of the database.

              OLLi

              --
              guy pouring the alcohol away...
              "That is a single malt. What kind of a monster are ya?"
              [Life on Mars 106]

              Comment

              Working...