Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    39
    Plugin Contributions
    1

    Default Message "Warning: No file uploaded" when editing prices in attributes controller.

    The message "Warning: No file uploaded" appears on top of the screen every time I edit products in the attributes controller. Additionally, I get the following warnings in the log file:

    [06-Mar-2019 06:45:44 CST6CDT] Request URI: /admin/attributes_controller.php?action=update_product_attribute&attribute_page=1&produ cts_filter=145
    #1 trim() called at [/admin/includes/functions/general.php:434]
    #2 zen_not_null() called at [/includes/classes/upload.php:85]
    #3 upload->parse() called at [/admin/attributes_controller.php:507]
    --> PHP Warning: trim() expects parameter 1 to be string, object given in /admin/includes/functions/general.php on line 434.

    [06-Mar-2019 06:45:44 CST6CDT] Request URI: /admin/attributes_controller.php?action=update_product_attribute&attribute_page=1&produ cts_filter=145
    #1 is_uploaded_file() called at [/includes/classes/upload.php:89]
    #2 upload->parse() called at [/admin/attributes_controller.php:507]
    --> PHP Warning: is_uploaded_file() expects parameter 1 to be string, object given in /includes/classes/upload.php on line 89.

    I found that line 82 of /includes/classes/upload.php:
    Code:
    'tmp_name' => (isset($GLOBALS[$this->file]) ? $GLOBALS[$this->file] : ''),
    has different pattern than the previous three lines, e.g. line 81:
    Code:
    'size'     => (isset($GLOBALS[$this->file . '_size']) ? $GLOBALS[$this->file . '_size'] : ''),
    So, I changed line 82 to match the previous lines pattern into:
    Code:
    'tmp_name' => (isset($GLOBALS[$this->file . '_tmp_name']) ? $GLOBALS[$this->file . '_tmp_name'] : ''),
    And the warning message disappeared. So did the log file warnings.

    Is this a bug or I'm missing something.

    ZC version: 1.5.6a.
    PHP Version: 7.2.0-dev
    MySQL 5.6.42-84.2-log

  2. #2
    Join Date
    Jul 2012
    Posts
    16,718
    Plugin Contributions
    17

    Default Re: Message "Warning: No file uploaded" when editing prices in attributes controller.

    It is a bug for which there is discussion of a proposed solution in github: https://github.com/zencart/zencart/pull/2106

    Note that your fix works because when evaluating $this->file . '_tmp_name' as a variable in the global space, it doesn't exist nor is it expected to exist based on the absence of the variable name that is being generated by that combination or combination attempt.

    In the discussion of that pull request there is also reference to another ZC forum thread solution. While I don't believe that the solution proposed there properly addresses the situation for the same reason that it identifies or attempts to refer to a variable that doesn't exist nor is expected to exist and therefore faults to an empty condition.

    DrByte seems to have an alternate solution, though I haven't seen it yet.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Replies: 14
    Last Post: 7 Mar 2017, 07:24 PM
  2. Change warning attributes message
    By Caralyn in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 6 Sep 2009, 02:10 PM
  3. Replies: 0
    Last Post: 2 Jun 2009, 10:25 PM
  4. Warning when adding/editing new products or categories
    By ideasgirl in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 26 Oct 2007, 02:47 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