hot to set disable_functions like php?

Discussion about the open-source Phalanger [?] project.

hot to set disable_functions like php?

Postby adesun » July 4th, 2012, 4:54 am

for some security problems , I want to disable some functions
I didn't find relevant settings in web.config
so if i's possible ,how to ?
thx!!

Adesun
adesun
 
Posts: 11
Joined: April 23rd, 2012, 3:22 am

Re: hot to set disable_functions like php?

Postby Jakub Misek » July 4th, 2012, 7:39 pm

"disable_functions" option is currently not supported.

However it is possible to modify a set of declared functions by implementing simple library in C#. So if you know C# and you are working on a Web application:

Just hook into delegate PHP.Core.RequestContext.RequestBegin
Code: Select all
PHP.Core.RequestContext.RequestBegin += () => {...};

Do it in some code that executes ideally once - when your (web)application starts, before first request is processed (e.g. in global.asax, Application_OnStart).

In the function {...}, you can add/remove functions from the dictionary
Code: Select all
ApplicationContext.Default.Functions


RequestBegin is called after all the configuration is loaded, before request is processed, and before any compilation begins, so you are free to alter set of functions that will be used during request.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: hot to set disable_functions like php?

Postby adesun » July 6th, 2012, 8:15 am

:)

got it !

thank you very much!
adesun
 
Posts: 11
Joined: April 23rd, 2012, 3:22 am


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 17 guests

cron

User Control Panel

Login

Who is online

In total there are 17 users online :: 0 registered, 0 hidden and 17 guests (based on users active over the past 5 minutes)
Most users ever online was 399 on April 19th, 2024, 11:49 pm

Users browsing this forum: No registered users and 17 guests