cubecart / v6

CubeCart Version 6
https://cubecart.com
72 stars 59 forks source link

FileManager $_sub_dir Might Be NULL #3481

Closed bhsmither closed 6 months ago

bhsmither commented 6 months ago

Minor:

In filemanager.class.php, near line 714, there is:

$sub_dir = (substr($this->_sub_dir, 0, 1) == '/') ? $this->_sub_dir : '/'.$this->_sub_dir;

PHP8 complains if $this->_sub_dir is null, being deprecated for substr().

It might be possible to assign the class attribute $_sub_dir='';.

Maybe easiest is to append a space to the test expression, then compare the zeroth position in the string:

$sub_dir = (($this->_sub_dir.' ')[0] == '/') ? $this->_sub_dir : '/'.$this->_sub_dir;
abrookbanks commented 6 months ago

Thank you.