• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • 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 Sep 6, 2016, 5:54 AM Sep 6, 2016, 11:50 AM

    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
    • T
      Tom Elliott
      last edited by Sep 7, 2016, 1:39 AM

      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 Sep 6, 2016, 2:08 PM

        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
        • T
          Tom Elliott
          last edited by Sep 6, 2016, 2:14 PM

          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 Sep 6, 2016, 2:35 PM

            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

            T 1 Reply Last reply Sep 6, 2016, 3:36 PM Reply Quote 0
            • T
              Tom Elliott @Sebastian Roth
              last edited by Sep 6, 2016, 3:36 PM

              @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
              • T
                Tom Elliott
                last edited by Sep 6, 2016, 9:45 PM

                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
                • T
                  Tom Elliott
                  last edited by Sep 7, 2016, 1:39 AM

                  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 Sep 7, 2016, 9:26 AM

                    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
                    1 / 1
                    • First post
                      8/8
                      Last post

                    163

                    Online

                    12.0k

                    Users

                    17.3k

                    Topics

                    155.2k

                    Posts
                    Copyright © 2012-2024 FOG Project