View Issue Details

IDProjectCategoryView StatusLast Update
0001742OXID eShop (all versions)2. ----- eShop backend (admin) -----public2010-04-02 15:24
Reportermhb Assigned To 
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.3.0 revision 26948 
Fixed in Version4.3.1 revision 27257 
Summary0001742: Warning: Invalid argument supplied for foreach() loop in core/oxsysrequirements.php file on line 228
DescriptionGives Warning: Invalid argument supplied for foreach() in ../core/oxsysrequirements.php on line 228 in new installation or update version. Warning is because of bug in the "if" statement
 if ( is_dir( $sFullPath ) ) {
                // adding subfolders
                foreach ( glob( $sFullPath."*", GLOB_ONLYDIR ) as $sNewFolder ) {
                    $aPathsToCheck[] = str_replace( $sPath, "", $sNewFolder ) . "/";
                }
            }
TagsNo tags attached.
Theme
BrowserAll
PHP Versionany
Database Versionany

Activities

dainius.bigelis

2010-04-02 11:14

reporter   ~0002458

@Developers: please check from the source code side if it is so and fix it.

tomas_liubinas

2010-04-02 15:22

reporter   ~0002462

According to the specification php glob() method sometimes can return FALSE instead of an empty array. Unfortunately I couldn't reprocude this case on my system. However the check is_array() should help in this case.

A quick fix would be replacing a few lines in <shop dir>/core/oxsysrequirements.php file:

approximately at line 225:

if ( is_dir( $sFullPath ) ) {
                // adding subfolders
                foreach ( glob( $sFullPath . "*", GLOB_ONLYDIR ) as $sNewFolder ) {
                    $aPathsToCheck[] = str_replace( $sPath, "", $sNewFolder ) . "/";
                }
            }

Should be replaced with:

            if ( is_dir( $sFullPath ) ) {
                // adding subfolders
                $aSubF = glob( $sFullPath."*", GLOB_ONLYDIR );
                if (is_array($aSubF)) {
                    foreach ( $aSubF as $sNewFolder ) {
                        $aPathsToCheck[] = str_replace( $sPath, "", $sNewFolder ) . "/";
                    }
                }
            }


I included this fix to the next patch.