Thread: bug for

Results 1 to 7 of 7
  1. #1

    Default bug for

    [Note: remember to include site URL, ZC version, list of plugins, PHP version, etc ... read the Posting Tips shown above for information to include in your post here.
    And, remove this comment before actually posting!]
    [26-Aug-2023 06:46:06 UTC] Request URI: /googlefroogle.php?feed=fy_un_tp&limit=115&start=1&feed_sort=id&key=2470a72221, IP address: 113.245.90.192, Language id 1
    #0 /home/.../public_html/heelsbags/includes/languages/english/googlefroogle.php(31): zen_debug_error_handler()
    #1 /home/.../public_html/heelsbags/googlefroogle.php(19): include('/home/g67mwiq1l...')
    --> PHP Warning: Constant FTP_FAILED already defined in /home/g67mwiq1lomm/public_html/heelsbags/includes/languages/english/googlefroogle.php on line 31.

    [26-Aug-2023 06:46:06 UTC] Request URI: /googlefroogle.php?feed=fy_un_tp&limit=115&start=1&feed_sort=id&key=2470a72221, IP address: 113.245.90.192, Language id 1
    #0 /home/.../public_html/heelsbags/googlefroogle.php(405): zen_debug_error_handler()
    --> PHP Warning: Array to string conversion in /home/g67mwiq1lomm/public_html/heelsbags/googlefroogle.php on line 405.

    [26-Aug-2023 06:46:06 UTC] PHP Fatal error: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, float given in /home/.../public_html/heelsbags/includes/classes/google_base.php:782
    Stack trace:
    #0 /home/.../public_html/heelsbags/includes/classes/google_base.php(782): date()
    #1 /home/../public_html/heelsbags/includes/classes/google_base.php(557): google_base->google_base_expiration_date()
    #2 /home/..../public_html/heelsbags/googlefroogle.php(678): google_base->universal_attributes()
    #3 {main}
    thrown in /home/.../public_html/heelsbags/includes/classes/google_base.php on line 782

    [26-Aug-2023 06:46:06 UTC] Request URI: /googlefroogle.php?feed=fy_un_tp&limit=115&start=1&feed_sort=id&key=2470a72221, IP address: 113.245.90.192
    --> PHP Fatal error: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, float given in /home/..../public_html/heelsbags/includes/classes/google_base.php:782
    Stack trace:
    #0 /home/.../public_html/heelsbags/includes/classes/google_base.php(782): date()
    #1 /home/.../public_html/heelsbags/includes/classes/google_base.php(557): google_base->google_base_expiration_date()
    #2 /home/.../public_html/heelsbags/googlefroogle.php(678): google_base->universal_attributes()
    #3 {main}
    thrown in /home/.../public_html/heelsbags/includes/classes/google_base.php on line 782.

    --------------------------------
    782 line:
    $retval = (date('Y-m-d', $expiration_date));

    and i have try to use
    $retval = ($date('y-m-d', $expiration_date));

    but the error also display

    -------------
    below is the "Google Merchant Center Feeder Configuration"
    Title Value Action
    Version 1.15.0
    Debugging true Info
    Google Merchant Center FTP Username Info
    Google Merchant Center FTP Password Info
    Google Merchant Center Server uploads.google.com Info
    Google Merchant Center PASV false Info
    Security Key 2470a72221 Info
    Store Address https://heelsbags.com Info
    Store Description Hikvision Dahua video security syst... Info
    Output File Name heelsbags Info
    Feed File Sort Model Info
    Compress Feed File false Info
    Uploaded date Info
    Output Directory feeds/google_merchant_center/ Info
    Enable Advanced XML Sanitization false Info
    Max Execution Time 300 Info
    Memory Limit 300M Info
    Limit Products to Process Info
    Start point for processing 1 Info
    Included Categories Info
    Excluded Categories Info
    Included Manufacturers Info
    Excluded Manufacturers Info
    Expiration Date Base now Info
    Expiration Date Adjust 0.5 Info
    Show Default Currency true Info
    Default Currency USD Info
    Show Offer ID id Info
    Shipping Options freeshipping Info
    Default Condition new Info
    Condition false Info
    Default Product Type Info
    Product Type full Info
    Show Feed Language true Info
    Feed Language 1 Info
    Show Weight false Info
    Weight Units pounds Info
    UPC/ISBN/EAN false Info
    Description 2 false Info
    Use Meta Title false Info
    Enable Map Pricing false Info
    Use cPath in url true Info
    Google Product Category Default Info
    Display Tax false Info
    Tax Country US Info
    Tax Region CA Info
    Tax Rate 0 Info
    Tax on Shipping y Info
    Payments Accepted Western Union,WireTransfer Info
    Payment Notes Western Union,WireTransfer Info
    Select Shipping Method freeshipper Info
    Table Zone ID Info
    Shipping Country 223 Info
    Shipping Region * Info
    Shipping Service UPS,Fedex,DHL,EMS Info
    Pickup do not display Info
    Alternate Image URL Info
    Image Handler true Info
    Attribute-Stock Plugin none Info
    Magic SEO URLs false Info
    Version

    Version Installed:

    Date Added: 08/20/2023
    Zen Cart:: the art of e-commerce
    Last edited by targetmarts; 26 Aug 2023 at 08:04 AM.

  2. #2
    Join Date
    Feb 2009
    Posts
    88
    Plugin Contributions
    1

    Idea or Suggestion Re: bug for

    I think you need to set your "Expiration Date Adjust" config to a whole number. I note in your config dump:

    Code:
    Expiration Date Adjust 0.5
    My value for this in the `configuration` table is a whole number, e.g. "29". I expect if this is "0.5" then it is treated as a float in string-to-number coercion. The function you quoted from is, I think, this one:

    Code:
        function google_base_expiration_date($base_date) {
          if(GOOGLE_PRODUCTS_EXPIRATION_BASE == 'now')
            $expiration_date = time();
          else
            $expiration_date = strtotime($base_date);
          $expiration_date += GOOGLE_PRODUCTS_EXPIRATION_DAYS*24*60*60;
          $retval = (date('Y-m-d', $expiration_date));
          return $retval;
        }
    On the 5th line of the function it uses + to add to $expiration_date, which in your case will probably result in a float instead of an int, which is then passed into `date()`, leading to your "PHP Fatal error: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, float given".

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

    Default Re: bug for

    Quote Originally Posted by neekfenwick View Post
    I think you need to set your "Expiration Date Adjust" config to a whole number. I note in your config dump:

    Code:
    Expiration Date Adjust 0.5
    My value for this in the `configuration` table is a whole number, e.g. "29". I expect if this is "0.5" then it is treated as a float in string-to-number coercion. The function you quoted from is, I think, this one:

    Code:
        function google_base_expiration_date($base_date) {
          if(GOOGLE_PRODUCTS_EXPIRATION_BASE == 'now')
            $expiration_date = time();
          else
            $expiration_date = strtotime($base_date);
          $expiration_date += GOOGLE_PRODUCTS_EXPIRATION_DAYS*24*60*60;
          $retval = (date('Y-m-d', $expiration_date));
          return $retval;
        }
    On the 5th line of the function it uses + to add to $expiration_date, which in your case will probably result in a float instead of an int, which is then passed into `date()`, leading to your "PHP Fatal error: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, float given".
    While agree use of a non- decimal number ought to resolve to an integer in the subsequent multiplication, there does not appear to be anything philosophically wrong with the factor of a half.

    My suggestion would be to cast the expiration date to an integer in the line where the function requires it to be an integer. It could be cast sooner, but there doesn't yet appear to be anything that would force retaining that datatype.

    So would change from:
    Code:
        function google_base_expiration_date($base_date) {
          if(GOOGLE_PRODUCTS_EXPIRATION_BASE == 'now')
            $expiration_date = time();
          else
            $expiration_date = strtotime($base_date);
          $expiration_date += GOOGLE_PRODUCTS_EXPIRATION_DAYS*24*60*60;
          $retval = (date('Y-m-d', $expiration_date));
          return $retval;
        }
    To:
    Code:
        function google_base_expiration_date($base_date) {
          if(GOOGLE_PRODUCTS_EXPIRATION_BASE == 'now')
            $expiration_date = time();
          else
            $expiration_date = strtotime($base_date);
          $expiration_date += GOOGLE_PRODUCTS_EXPIRATION_DAYS*24*60*60;
          $retval = (date('Y-m-d', (int)$expiration_date));
          return $retval;
        }
    Or if must, in a line just before that function as its own line to do the casting.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Feb 2009
    Posts
    88
    Plugin Contributions
    1

    Default Re: bug for

    @mc12345678 I agree, both philosophically and according to the Merchant Center feed spec where teh date value finally ends up (https://support.google.com/merchants.../6324499?hl=en) there's nothing logically preventing us representing partial days. I have to run out right now. Surely there's a way to not cast to int, but actually get a partial day e.g. `<g:expiration_date>2016-02-24T00:30-0800</g:expiration_date>` as in the spec? Anything that isn't rounded off to a 24 hour period. I'd have a fiddle with it now but I really have to run.

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,539
    Plugin Contributions
    88

    Default Re: bug for

    Note, too, that the FTP upload no longer works as Google is now requiring an SFTP connection: https://support.google.com/merchants...28996982699-NA

  6. #6
    Join Date
    Jul 2012
    Posts
    16,739
    Plugin Contributions
    17

    Default Re: bug for

    Quote Originally Posted by neekfenwick View Post
    @mc12345678 I agree, both philosophically and according to the Merchant Center feed spec where teh date value finally ends up (https://support.google.com/merchants.../6324499?hl=en) there's nothing logically preventing us representing partial days. I have to run out right now. Surely there's a way to not cast to int, but actually get a partial day e.g. `<g:expiration_date>2016-02-24T00:30-0800</g:expiration_date>` as in the spec? Anything that isn't rounded off to a 24 hour period. I'd have a fiddle with it now but I really have to run.
    Understand you are away, no issues.

    When I used a php sandbox to define a constant to a string containing a decimal number (e.g. a float) and then multiplied it out similar to the above code, then a var_dump on it, the numerical result was integerish (no decimal value displayed), but the datatype was float.

    Not quite sure if there is some concern about the casting to the appropriate datatype or if there is some worry of an overflow related to the numerical value being larger than allowed by an integer or some other concern.

    Of course I recommend duplicating the testing and continuing to propose a way forward. I know one thought I had was turning back into a string, though consideration should be had about the spec value and just how many decimal places one might try to use as it is still possible to get a partial value prior to carrying as an integer.

    Not sure why such precision would be attempted, but would be best for whatever solution to identify the reasons for and what those limitations are.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,594
    Plugin Contributions
    30

    Default Re: bug for

    Since this bug is from an old Google Merchant Center feed plugin, note that there are updated versions available:

    Most recent/recommended (but not used by me yet):
    https://github.com/lat9/gpsf

    And an update to the old one
    https://github.com/torvista/Zen_Cart..._Center_Feeder
    Branch main may fix your problem.
    Branch 1.6 is drastically different, I (unfortunately) spent a lot of time on it just before lat9's emerged.

    Do not drop these into your production server without testing...
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

 

 

Similar Threads

  1. Instructions for Bug Fixers
    By swguy in forum Bug Reports
    Replies: 0
    Last Post: 3 Jun 2019, 11:32 AM
  2. Replies: 4
    Last Post: 24 Jul 2010, 01:06 PM
  3. bug fix for IE6?
    By mygalaxy in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 14 Dec 2007, 09:39 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