kolber / stacey

Cheap & easy content management
http://staceyapp.com
MIT License
1.04k stars 132 forks source link

Get rid of evals #6

Open herrquark opened 13 years ago

herrquark commented 13 years ago

instead of foreach($assets as $asset_type => $asset_files) eval('$page->'.$asset_type.'=$asset_files;'); why not use something like foreach($assets as $asset_type => $asset_files) $page->$asset_type = $asset_files; etc.

kolber commented 13 years ago

Irritatingly, that technique doesn't work with all versions of php5. Even worse, the correct technique, call_user_func has bugs on certain php5.* versions, but not all. So eval turns out to be the only way (that I know of) to do this, while supporting all php5 variations.