Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What's the sence?


mcmannehan

Recommended Posts

Posted

In the last version osC BS 3 and BS 4 i find in /catalog/admin/includes/classes/upload.php

if (isset($_FILES[$this->file])) {
        $file = array('name' => $_FILES[$this->file]['name'],
                      'type' => $_FILES[$this->file]['type'],
                      'size' => $_FILES[$this->file]['size'],
                      'tmp_name' => $_FILES[$this->file]['tmp_name']);
      } elseif (isset($_FILES[$this->file])) {
        $file = array('name' => $_FILES[$this->file]['name'],
                      'type' => $_FILES[$this->file]['type'],
                      'size' => $_FILES[$this->file]['size'],
                      'tmp_name' => $_FILES[$this->file]['tmp_name']);
      }

i really ask by myself, what is that? Makes no sence!!!
An if and an else with the same!!!!
So i changed to:

if (isset($_FILES[$this->file])) {
        $file = array('name' => $_FILES[$this->file]['name'],
                      'type' => $_FILES[$this->file]['type'],
                      'size' => $_FILES[$this->file]['size'],
                      'tmp_name' => $_FILES[$this->file]['tmp_name']);
      }

every works fine.

Any suggestion why this is since the beginning of osC in the upload file?

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Posted

Your observation is correct that it's redundant code. Presumably the author meant to get the fields name, type, size, and tmp_name from somewhere else, if $_FILES[$this->file] wasn't available. Does anyone have any idea where these fields might come from?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...