#23 Invalid argument supplied for foreach() XCube_Controller.php

open
nobody
None
5
2012-03-28
2012-03-28
Mikhail Miguel
No

Blank page of death with the message:
"Warning: Invalid argument supplied for foreach() in /core/XCube_Controller.class.php on line 431"

The function _processPreload($path) (around the line 431) makes a recursive directory scan that may cause a conflict with the open_basedir function (if on, in some php.ini settings), resulting in a blank page without any information about it.

Discussion

  • HIKAWA Kilica
    HIKAWA Kilica
    2012-03-28

    I moved this issue to XCube core tracker.

    If open_basedir prohibit to open files under preload, there is nothing what we can do to process normally.
    How do you think what we should do ? Check open_basedir settting and show alert message before the process die ?

     
  • HIKAWA Kilica
    HIKAWA Kilica
    2012-03-28

    • milestone: 1999071 -->
     
  • Mikhail Miguel
    Mikhail Miguel
    2012-03-29

    Hi! Sorry, I messed up badly!!!

    This problem occurs because the class 'believes' in the existence of a .class.php file to be 'required' in the preload directory. This error happens only if there are no preload files to be included ("required"). Perhaps the system has understood the impossibility to include preload files that do not exist as a kind of access denied by the open_basedir rules (I`m not sure). Anyway, maybe a simple "if file exist" can solve the problem.

    Sorry again my attention fault, this is not about a 'recursive directory scan' or even about the open_basedir.

    ----------------
    PS (off topic):
    In line 428, a slash is included to the path:
    $path = $path . "/";
    in line 431, another slash is included:
    $path.'/*.class.php';
    Resulting in $path.'//*.class.php';
    - is working, but...