Thread: Install bugs

Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2018
    Posts
    11
    Plugin Contributions
    0

    Default Install bugs

    (submitting again because post never showed up in the forum)

    zen-cart-v1.5.7c
    PHP 8.0.15
    MariaDB 10.5.13

    1.
    Code:
     PHP Fatal error:  Uncaught TypeError: mysqli_close(): Argument #1 ($mysql) must be of type mysqli, bool given in /usr/home/sites/zen15/www/includes/classes/db/mysql/query_factory.php:130
    Stack trace:
    #0 /usr/home/sites/zen15/www/includes/classes/db/mysql/query_factory.php(130): mysqli_close()
    #1 /usr/home/sites/zen15/www/includes/classes/db/mysql/query_factory.php(135): queryFactory->close()
    #2 /usr/home/sites/zen15/www/zc_install/includes/classes/class.systemChecker.php(44): queryFactory->__destruct()
    #3 /usr/home/sites/zen15/www/zc_install/includes/modules/pages/index/header_php.php(62): systemChecker->runTests()
    #4 /usr/home/sites/zen15/www/zc_install/index.php(40): require('/usr/home/sites...')
    #5 {main}
      thrown in /usr/home/sites/zen15/www/includes/classes/db/mysql/query_factory.php on line 130
    Fix
    Code:
    --- includes/classes/db/mysql/query_factory.php.old     2022-02-09 22:06:21.496980000 -0800
    +++ includes/classes/db/mysql/query_factory.php 2022-02-09 20:22:46.536533000 -0800
    @@ -127,7 +127,8 @@
       }
    
       function close() {
    -    @mysqli_close($this->link);
    +    if($this->link)
    +        @mysqli_close($this->link);
         unset($this->link);
       }
    2.
    Code:
    [09-Feb-2022 21:55:04 America/Vancouver] PHP Warning:  fopen(includes/nginx_conf/zencart_ngx_server.conf): Failed to open stream: Permission denied in /usr/home/sites/zen15/www/_zc_install/includes/modules/pages/completion/header_php.php on line 62
    [09-Feb-2022 21:55:04 America/Vancouver] PHP Fatal error:  Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in /usr/home/sites/zen15/www/_zc_install/includes/modules/pages/completion/header_php.php:63
    Stack trace:
    #0 /usr/home/sites/zen15/www/_zc_install/includes/modules/pages/completion/header_php.php(63): fwrite()
    #1 /usr/home/sites/zen15/www/_zc_install/index.php(40): require('/usr/home/sites...')
    #2 {main}
      thrown in /usr/home/sites/zen15/www/_zc_install/includes/modules/pages/completion/header_php.php on line 63
    Code:
    root@www-php8:/home/sites/zen15/www/logs # ll ../_zc_install/includes/nginx_conf/
    total 10
    -rw-r--r--  1 zen15  nginx     24 Mar  5  2021 .gitignore
    -rw-r--r--  1 zen15  nginx  12694 Mar  5  2021 ngx_server_template.txt
    -rw-r--r--  1 zen15  nginx   2257 Mar  5  2021 zencart_ngx_http.conf

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,681
    Plugin Contributions
    123

    Default Re: Install bugs

    To confirm: You're using Ngnix, not Apache?
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Install bugs

    Quote Originally Posted by cstdenis2 View Post
    (submitting again because post never showed up in the forum)

    zen-cart-v1.5.7c
    PHP 8.0.15
    MariaDB 10.5.13

    1.
    Code:
     PHP Fatal error:  Uncaught TypeError: mysqli_close(): Argument #1 ($mysql) must be of type mysqli, bool given in /usr/home/sites/zen15/www/includes/classes/db/mysql/query_factory.php:130
    Stack trace:
    #0 /usr/home/sites/zen15/www/includes/classes/db/mysql/query_factory.php(130): mysqli_close()
    #1 /usr/home/sites/zen15/www/includes/classes/db/mysql/query_factory.php(135): queryFactory->close()
    #2 /usr/home/sites/zen15/www/zc_install/includes/classes/class.systemChecker.php(44): queryFactory->__destruct()
    #3 /usr/home/sites/zen15/www/zc_install/includes/modules/pages/index/header_php.php(62): systemChecker->runTests()
    #4 /usr/home/sites/zen15/www/zc_install/index.php(40): require('/usr/home/sites...')
    #5 {main}
      thrown in /usr/home/sites/zen15/www/includes/classes/db/mysql/query_factory.php on line 130
    Fix
    Code:
    --- includes/classes/db/mysql/query_factory.php.old     2022-02-09 22:06:21.496980000 -0800
    +++ includes/classes/db/mysql/query_factory.php 2022-02-09 20:22:46.536533000 -0800
    @@ -127,7 +127,8 @@
       }
    
       function close() {
    -    @mysqli_close($this->link);
    +    if($this->link)
    +        @mysqli_close($this->link);
         unset($this->link);
       }
    While there is not a good/consistent reason that the above function would be called twice, but wouldn't a subsequent call cause a log item in attempting to access an unset variable?

    Would suggest modifying the fix to:
    Code:
    --- includes/classes/db/mysql/query_factory.php.old     2022-02-09 22:06:21.496980000 -0800
    +++ includes/classes/db/mysql/query_factory.php 2022-02-09 20:22:46.536533000 -0800
    @@ -127,7 +127,8 @@
       }
    
       function close() {
    -    @mysqli_close($this->link);
    +    if(!empty($this->link)) {
    +        @mysqli_close($this->link);
    +    }
         unset($this->link);
       }
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,684
    Plugin Contributions
    9

    Default Re: Install bugs

    with regards to the first bug being reported, according to github, this issue was already addressed in the move since v157c being released.

    v157c:
    https://github.com/zencart/zencart/b....php#L129-L132


    current v157 codeset:
    https://github.com/zencart/zencart/b....php#L129-L133
    Last edited by carlwhat; 10 Feb 2022 at 07:46 PM.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Install bugs

    Quote Originally Posted by carlwhat View Post
    with regards to the first bug being reported, according to github, this issue was already addressed in the move since v157c being released.

    v157c:
    https://github.com/zencart/zencart/b....php#L129-L132


    current v157 codeset:
    https://github.com/zencart/zencart/b....php#L129-L133
    To which my previous comment still applies for the same reason that a notice is thrown on a subsequent call to that code after $this->link is unset from a previous success of executing that code.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,684
    Plugin Contributions
    9

    Default Re: Install bugs

    Quote Originally Posted by mc12345678 View Post
    To which my previous comment still applies for the same reason that a notice is thrown on a subsequent call to that code after $this->link is unset from a previous success of executing that code.
    YAGNI.

    not a fan. look at the code. can not see steps necessary to introduce said notice.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  7. #7
    Join Date
    Feb 2018
    Posts
    11
    Plugin Contributions
    0

    Default Re: Install bugs

    Quote Originally Posted by swguy View Post
    To confirm: You're using Ngnix, not Apache?
    Yes, that is correct.

  8. #8
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,681
    Plugin Contributions
    123

    Default Re: Install bugs

    Can you update your copy of the close() function from Zen Cart 1.5.8 on Github and confirm that things work properly?

    public function close(): void
    {
    if (!$this->link) return;
    @mysqli_close($this->link);
    unset($this->link);
    }
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. v150 Bugs?
    By mprough in forum Bug Reports
    Replies: 1
    Last Post: 13 Jul 2012, 12:04 AM
  2. Bugs installation.
    By yanayun in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 17 May 2006, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR