Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Odd assetic recompile error

edited April 2013 in Apps

Code that works on my workstation throws an error when I upload it to my CentOS server and I'm not sure why. File: apps/assetic/handlers/recompile.php

Code:

foreach ($files as $file) {
    if (preg_match ('/\.html$/', $file)) {
        touch ($file);
    }
}

The error I get is Invalid argument supplied for foreach() which I believe means that php thinks $files is not an array. However, if I var_dump ($files), I get

array(5) { [0]=> string(18) "layouts/admin.html" [1]=> string(16) "layouts/pdf.html" [2]=> string(23) "layouts/properties.html" [3]=> string(23) "layouts/one-column.html" [4]=> string(20) "layouts/default.html" } 

If I change the code to

for($i=0; $i<count($files); $i++){
    $file = $files[$i];
    if (preg_match ('/\.html$/', $file)) {
        touch ($file);
    }
}

It runs fine.

php on my workstation: PHP 5.4.13 (cli) (built: Mar 22 2013 08:41:19) php on the server: PHP 5.3.3 (cli) (built: Feb 22 2013 02:51:11)

Permissions are similar both places.

I found one discussion where someone had the same problem, but no solution yet.

Comments

Sign In or Register to comment.