View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001742 | OXID eShop (all versions) | 2. ----- eShop backend (admin) ----- | public | 2010-04-02 11:03 | 2010-04-02 15:24 |
Reporter | mhb | Assigned To | |||
Priority | high | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 4.3.0 revision 26948 | ||||
Fixed in Version | 4.3.1 revision 27257 | ||||
Summary | 0001742: Warning: Invalid argument supplied for foreach() loop in core/oxsysrequirements.php file on line 228 | ||||
Description | Gives 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 ) . "/"; } } | ||||
Tags | No tags attached. | ||||
Theme | |||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
|
@Developers: please check from the source code side if it is so and fix it. |
|
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. |