drewm / morse

A feature detection library for PHP code that needs to run in multiple different environments
MIT License
160 stars 4 forks source link

Check for system functions #13

Closed peter-mw closed 9 years ago

peter-mw commented 9 years ago

Hello,

I would like to have functionality to check for some system functions availability

The functions i want to check are

ini_set set_time_limit exec shell_exec ignore_user_abort passthru system popen proc_open

On some hosts those functions are disabled with the disable_functions setting in php.ini

Maybe the system functions deserve a namespace like system/ini_set , etc

Currently i am using very simple way to check but i would like to see support for those functions in the morse-php library, so i can include it in my project

// example way to check

$disabled = ini_get('disable_functions');

if (!strstr($disabled, 'ini_set')){
ini_set('memory_limit', '512M');
}

if (!strstr($disabled, 'set_time_limit')) {
set_time_limit(600);
}

if (!strstr($disabled, 'ignore_user_abort')) {
ignore_user_abort();
}
drewm commented 9 years ago

This sounds like a good addition.

nlzet commented 9 years ago

I guess this is already resolved by https://github.com/drewm/morse/commit/f198154a88dbcf601d33e5ecc78cbdacf6404937

drewm commented 9 years ago

Only 7 minutes ago - give me a chance! Fixed in https://github.com/drewm/morse/commit/88d6e1217f8b424e384354d270f8501e3e8bb165

nlzet commented 9 years ago

Oops, didn't look at the date sorry

peter-mw commented 9 years ago

Nice! Thanks for the addition

I am going to use those now :)