• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    PHP parse error on string concat over 2 lines

    Scheduled Pinned Locked Moved Solved
    Bug Reports
    3
    8
    1.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      shruggy
      last edited by shruggy

      Running FOG on CentOS 6. I’ve just done two things at once:

      1. Upgraded PHP 5.5.34 to 5.5.38
      $ rpm -q php
      php-5.5.38-1.el6.remi.i686
      
      1. Upgraded FOG to trunk (1.3.0-RC-9, SVN Revision: 5952)

      The upgrade failed with

      Backing up database .... Failed!
      

      /var/log/httpd/error_log:

      PHP Parse error:  syntax error, unexpected '.', expecting ',' or ';' in /var/www/html/fog/lib/fog/fogcontroller.class.php on line 106
      

      After the following change I’ve managed to upgrade FOG successfully.

      diff --git a/packages/web/lib/fog/fogcontroller.class.php b/packages/web/lib/fog/fogcontroller.class.php
      index bab94b2..ed59e42 100644
      --- a/packages/web/lib/fog/fogcontroller.class.php
      +++ b/packages/web/lib/fog/fogcontroller.class.php
      @@ -102,8 +102,7 @@ abstract class FOGController extends FOGBase
            *
            * @var string
            */
      -    protected $insertQueryTemplate = "INSERT INTO `%s` (%s) "
      -        . "VALUES (%s) ON DUPLICATE KEY UPDATE %s";
      +    protected $insertQueryTemplate = "INSERT INTO `%s` (%s) VALUES (%s) ON DUPLICATE KEY UPDATE %s";
           /**
            * The delete query template to use.
            *
      

      Best regards,
      Sergey Romanov

      1 Reply Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott
        last edited by

        The concat is now fixed in RC 10.

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • S
          Sebastian Roth Moderator
          last edited by

          Moved to bug reports as this seems to be one from my point of view. Just a simple one. 🙂 Thanks for reporting!

          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

          1 Reply Last reply Reply Quote 1
          • Tom ElliottT
            Tom Elliott
            last edited by

            I’m aware but unsure why this is an issue. Concat lines should work fine then again maybe a simple comma to separate might help?

            These were separated because of psr-2 standards of which I’m trying to follow for more easily readable and follow able code.

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            1 Reply Last reply Reply Quote 0
            • S
              Sebastian Roth Moderator
              last edited by

              I guess what you could try instead is (untested):

              protected $insertQueryTemplate = "INSERT INTO `%s` (%s) ";
              protected $insertQueryTemplate .= "VALUES (%s) ON DUPLICATE KEY UPDATE %s";
              

              Not very nice. 😞

              Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

              Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

              Tom ElliottT 1 Reply Last reply Reply Quote 0
              • Tom ElliottT
                Tom Elliott @Sebastian Roth
                last edited by

                @Sebastian-Roth I don’t know if variable instantiation can be defined that way but I can try it.

                Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                1 Reply Last reply Reply Quote 0
                • Tom ElliottT
                  Tom Elliott
                  last edited by

                  It cannot be done that way. I suppose it’ll be simpler to have the one line over 85 characters (Sigh…).

                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                  Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                  Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                  1 Reply Last reply Reply Quote 1
                  • Tom ElliottT
                    Tom Elliott
                    last edited by

                    The concat is now fixed in RC 10.

                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                    1 Reply Last reply Reply Quote 0
                    • S
                      shruggy
                      last edited by

                      Well, I guess the ‘over two lines’ part is misleading and should be ‘when declaring a class property’ instead. It seems the ability to use scalar expressions in property declarations was only added in PHP 5.6.0. The only other possibility that would work in PHP 5.5.x in this context is heredoc/nowdoc:

                          protected $insertQueryTemplate = <<<EOT
                      INSERT INTO `%s` (%s) VALUES (%s) ON DUPLICATE KEY UPDATE %s
                      EOT;
                      
                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post

                      146

                      Online

                      12.0k

                      Users

                      17.3k

                      Topics

                      155.2k

                      Posts
                      Copyright © 2012-2024 FOG Project