Skip to content

Tablerate->getCsvFile() fails with non-default PHP upload_tmp_dir #10058

@zts

Description

@zts

Preconditions

  1. PHP upload_tmp_dir is set to a directory outside /tmp/.
  2. Magento CE 2.1.x, code still in latest version here: https://github.com/magento/magento2/blob/develop/app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate.php#L315

Steps to reproduce

  1. Make a new directory for uploads, eg mkdir -p /var/lib/php/uploads && chmod 1777 /var/lib/php/uploads
  2. Set PHP upload_tmp_dir to this directory. eg, add upload_tmp_dir = /var/lib/php/uploads to /etc/php.ini
  3. Login to Magento Admin
  4. Go to Stores > Configuration > Sales > Shipping Methods
  5. Select Table Rates, and enable
  6. Click "Import"
  7. Choose a file, click save.

Expected result

  1. Table rates are updated

Actual result

  1. Receive an error, eg The file “/tmp/var/lib/php/uploads/phphEpJe5” doesn’t exist

Cause

This behaviour occurs because getCsvFile opens the /tmp directory, then looks for the uploaded file relative to that directory. This only works when upload_tmp_directory is set to /tmp, or a subdirectory of /tmp.

Metadata

Metadata

Assignees

Labels

Component: ImportExportFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions