Adrian Föder
Adrian Föder

Reputation: 891

What is the documented behavior of functions invocation listed in disable_functions

I were not able to find a proper source stating what the intended behaviour is when invoking a function listed in disable_functions.

My observation is that a log entry is created saying something like

[04-Sep-2014 16:17:55 UTC] PHP Warning: curl_exec() has been disabled for security reasons in {file} {line}

But what does the function return in such a case? And I mean what is it documented to return?

Upvotes: 0

Views: 64

Answers (2)

user1233508
user1233508

Reputation:

This functionality is not formally documented, but if you look at the source, PHP has a placeholder function that gets called instead of a disabled function. This placeholder function only generates the warning and does not explicitly return any value. This "lack of a return value" is translated to a NULL before your PHP code sees it.

Upvotes: 1

AbraCadaver
AbraCadaver

Reputation: 79014

I haven't seen it documented, but it returns NULL. With disable_functions = file_get_contents:

var_dump(file_get_contents(__FILE__));

Warning: file_get_contents() has been disabled for security reasons in test.php on line 2

NULL

Same results with curl_exec.

Upvotes: 0

Related Questions