Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2013
    Posts
    7
    Plugin Contributions
    0

    Default [Done v1.6.0] Installer database upgrade db-error fails

    From zc_install/includes/classes/installer.php:686
    Code:
    $this->db->Execute($sql) or die("Error in query: $sql".$this->db->ErrorMsg());
    But in /includes/classes/db/mysql/query_factory.php no function ErrorMsg() is defined (just checked in 1.54). Apparently ErrorMsg() is only called in the installer-script.

    This makes it difficult to debug why Zc_install -> Database Upgrade fails, since it crashes the whole script, and no error messages is displayed.

    Tested with 1.53, just checked that 1.54 seems to suffer from same bug.

    For reference:
    http://www.zen-cart.com/showthread.p...d-queryFactory

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Installer database upgrade db-error fails

    I've done hundreds of installs and upgrades of v1.5.3 and v1.5.4, and don't recall seeing anything like what you're describing.

    Please describe more detail of how exactly I should be able to recreate these symptoms, including server configuration and all alterations to any ZC files.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Installer database upgrade db-error fails

    Quote Originally Posted by DrByte View Post
    I've done hundreds of installs and upgrades of v1.5.3 and v1.5.4, and don't recall seeing anything like what you're describing.

    Please describe more detail of how exactly I should be able to recreate these symptoms, including server configuration and all alterations to any ZC files.
    Mind if I add my 2cents worth here? <too bad>

    From what I can gather is that if you can somehow *force* a DB error during the install, the code *should* produce an error message as to the reason for the error, but because the db->ErrorMsg() isn't defined anywhere it causes a PHP error that stops any further processing.

    I'm guessing that this piece of code would rarely (if ever) be triggered because under normal conditions any errors would have been triggered or trapped before it even gets to this part of the code, which means that the ErrorMsg output would be superfluous anyway (probably a left over from old code?).

    IOW, it isn't an actual problem, unless perhaps the DB server happens to 'die' at some stage between it's initial test/check and this part of the code.

    At least that is my take on things.

    Cheers
    RodG

  4. #4
    Join Date
    Jan 2013
    Posts
    7
    Plugin Contributions
    0

    Default Re: Installer database upgrade db-error fails

    Quote Originally Posted by DrByte View Post
    I've done hundreds of installs and upgrades of v1.5.3 and v1.5.4, and don't recall seeing anything like what you're describing.

    Please describe more detail of how exactly I should be able to recreate these symptoms, including server configuration and all alterations to any ZC files.
    Current
    1. Make a new Zen Cart 1.53 installation
    2. Copy Database from 1.3.9 to this installation, except Admin-table (to recreate the error in the query)
    3. Go to zc_install/index.php
    4. Start doing Database upgrade from 1.39 to 1.53
    5. When you actually try to upgrade the database, you will get HTTP Response 500 - Internal Server error
    6. In logs -folder you will find new zcInstallDEBUG-file with following message:
    Code:
    [10-Feb-2015 16:39:16] PHP Fatal error:  Call to undefined method queryFactory::ErrorMsg() in /var/www/html/zc153/zc_install/includes/classes/installer.php on line 728
    Expected
    1. - 5. the same
    6. Log message should have the SQL-error to help track down the real problem, eg:
    Code:
    [10-Feb-2015 16:47:44] PHP Fatal error:  1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 :: UPDATE admin SET admin_profile = 1 WHERE admin_id =  ==>
    Actually I had the Admin table myself, but had some other problem in the old database, for which I needed to write the ErrorMsg to queryFactory class to see the actual error message from MySQL.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Installer database upgrade db-error fails

    So, this situation is caused by deleting (or not copying over) the admin table?

    (I'm not disagreeing that ErrorMsg() is missing. But if it's even being triggered at all, there's a more important issue to handle, thus my many questions.)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Installer database upgrade db-error fails

    Quote Originally Posted by Jarkko View Post
    Current
    1. Make a new Zen Cart 1.53 installation
    2. Copy Database from 1.3.9 to this installation, except Admin-table (to recreate the error in the query)
    3. Go to zc_install/index.php
    4. Start doing Database upgrade from 1.39 to 1.53
    Actually, when I delete the admin table, I can't even start the upgrade because the inspection process discovers that there's no admin table when checking whether the various version steps need to be run, and throws a blank screen when it tests whether it needs to pre-check the v150 box. Not even a 500 Internal Server Error. And doesn't trigger ErrorMsg() at all ... just "Call to a member function MoveNext() on boolean".

    Further, your first post quoted line 686, but then your SQL query later (UPDATE admin SET admin_profile = 1 WHERE admin_id = ) is from the query on 728.

    I'd still like to be able to understand the order of steps which consistently trigger the problem where your admin table is gone.

    I toyed with the idea that maybe you had emptied your admin table, but that theory failed too, because you can't even start the upgrade process without providing a valid admin password. So, there had to be a valid admin user in the database already, else you couldn't have started the upgrade, and thus couldn't have triggered the error.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Installer database upgrade db-error fails

    Quote Originally Posted by Jarkko View Post
    Code:
    [10-Feb-2015 16:47:44] PHP Fatal error:  1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 :: UPDATE admin SET admin_profile = 1 WHERE admin_id =  ==>
    Quote Originally Posted by DrByte View Post
    your SQL query later (UPDATE admin SET admin_profile = 1 WHERE admin_id = ) is from the query on 728.
    Still looking at this, the PHP code that builds that query sets "...admin_id = " . (int)$aVariable ... so, even if $aVariable is blank the (int) forces it to become an integer value, thus it would always be "something", not a blank value like your error message reported.

    ... so that leads me to have to believe your Zen Cart zc_install code has been tampered with.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Installer database upgrade db-error fails

    Here's a fix to the "symptom" where ErrorMsg() triggers a crash:

    Replace 4 references to $this->db->ErrorMsg() with $this->db->show_error()
    3 in /zc_install/includes/classes/installer.php on lines 686, 690, 728
    and 1 in /zc_install/includes/modules/pages/store_setup/header_php.php on line 90.

    But that's just a bandage because it still doesn't explain HOW you even tripped the problem in the first place ... which is a more important piece of information. Armed with that we could do additional inspections to report potential problems sooner, and avoid even needing to look at error logs.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Jan 2013
    Posts
    7
    Plugin Contributions
    0

    Default Re: Installer database upgrade db-error fails

    Hi

    Sorry if I misled you, I should have made it clearer that bug wasn't about the failure to update itself, but about the missing ErrorMsg() -function.

    Indeed I had tampered the install-script, since I was suffering the "Admin Password required to proceed with upgrade" problem:
    http://www.zen-cart.com/showthread.p...1-5-3-to-1-5-4

    I searched for any information and fixes for that error, and tried some fixes to go past the incorrect Admin Password, but none worked. Then I started to dig in to the code, and made changes to install-script itself, which probably made the SQL fail, and therefore I encountered the error about missing ErrorMsg().

    I just thought you might want to fix that missing ErrorMsg() -calls, since it had affected not only me, but also the user for whom thread I referenced in my first post.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Installer database upgrade db-error fails

    Fixes for the call to ErrorMsg() are being made in v1.6.0.

    Thanks for pointing it out.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Replies: 5
    Last Post: 21 Mar 2016, 09:45 PM
  2. Replies: 12
    Last Post: 26 Jun 2013, 02:14 AM
  3. Replies: 2
    Last Post: 28 Mar 2013, 10:56 PM
  4. [Done v1.3.9] Optimize Database error
    By JunWeiStore in forum Bug Reports
    Replies: 1
    Last Post: 7 Jul 2009, 03:06 AM
  5. Replies: 13
    Last Post: 11 Mar 2007, 10:38 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