Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Optimization of set_time_limit() call #36

Closed
wants to merge 1 commit into from

2 participants

Christoph Ziegenberg Jeremy Lindblom
Christoph Ziegenberg

When the "set_time_limit()" function is disabled, the call of this function creates an error like this: "set_time_limit() has been disabled for security reasons"

This function is often disabled by hosters who offer shared hosting, also some current PAAS hosters, like PHPFog/AppFog (see http://docs.phpfog.com/faqs/#sharedvdedicated).

I added a check of the 'disable_functions' configuration setting before the call.

Christoph Ziegenberg ziege Optimization of set_time_limit() call
When the "set_time_limit()" function is disabled, the call of this function creates an error like this: "set_time_limit() has been disabled for security reasons"

This function is often disabled by hosters who offer shared hosting, also some current PAAS hosters, like PHPFog/AppFog (see http://docs.phpfog.com/faqs/#sharedvdedicated).

I added a check of the 'disable_functions' configuration setting before the call.
800f6e2
Jeremy Lindblom
Owner

Thanks for letting us know about this. That seems like a reasonable fix. I'll see what we can do to integrate this soon. Are you aware of any other functions that are in the disable_functions list for PHP/AppFog?

Note to self: double-check for other occurrences of set_time_limit() in the SDK.

Christoph Ziegenberg

Here are two lists of the disabled functions of PAAS providers:

PHPFog (http://docs.phpfog.com/faqs/#sharedvdedicated):

  • escapeshellarg, escapeshellcmd
  • exec, passthru, pcntl_exec, shell_exec, system
  • proc_close, proc_get_status, proc_open, proc_nice, proc_terminate
  • popen, pclose
  • file_get_contents (for remote URLS)
  • fopen (for remote URLS)
  • dl
  • disk_free_space, diskfreespace, disk_total_space
  • set_time_limit, ini_restore
  • tmpfile
  • openlog
  • show_source, highlight_file
  • link, symlink
  • php_uname
  • apache_child_terminate, apache_get_modules, apache_get_version, apache_getenv, apache_note, apache_setenv
  • posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_getpwuid, posix_uname

CloudControl (http://phpinfo.cloudcontrolled.com/):

  • escapeshellarg, escapeshellcmd
  • system, exec, passthru, shell_exec
  • proc_open, proc_nice
  • file_open_base
  • pcntl_fork, pcntl_exec,
  • popen, proc_open
  • disk_free_space, diskfreespace, disk_total_space
  • syslog
  • posix_getpwnam
  • pfsockopen, stream_socket_server
Jeremy Lindblom
Owner

Awesome, thanks for looking into that!

Jeremy Lindblom
Owner

This has been fixed in our development copy and will be included in the next update to the SDK. Thanks again! Since we don't accept pull requests directly, I will close this pull request and add you to our CONTRIBUTORS docs.

Jeremy Lindblom jeremeamia closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 7, 2012
  1. Christoph Ziegenberg

    Optimization of set_time_limit() call

    ziege authored
    When the "set_time_limit()" function is disabled, the call of this function creates an error like this: "set_time_limit() has been disabled for security reasons"
    
    This function is often disabled by hosters who offer shared hosting, also some current PAAS hosters, like PHPFog/AppFog (see http://docs.phpfog.com/faqs/#sharedvdedicated).
    
    I added a check of the 'disable_functions' configuration setting before the call.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/requestcore/requestcore.class.php
10 lib/requestcore/requestcore.class.php
View
@@ -819,7 +819,10 @@ public function process_response($curl_handle = null, $response = null)
*/
public function send_request($parse = false)
{
- set_time_limit(0);
+ if (strpos(ini_get('disable_functions'), 'set_time_limit') === false)
+ {
+ set_time_limit(0);
+ }
$curl_handle = $this->prep_request();
$this->response = curl_exec($curl_handle);
@@ -852,7 +855,10 @@ public function send_request($parse = false)
*/
public function send_multi_request($handles, $opt = null)
{
- set_time_limit(0);
+ if (strpos(ini_get('disable_functions'), 'set_time_limit') === false)
+ {
+ set_time_limit(0);
+ }
// Skip everything if there are no handles to process.
if (count($handles) === 0) return array();
Something went wrong with that request. Please try again.