kitech / php-go

Write PHP extension using go/golang. Zend API wrapper for go/golang.
879 stars 107 forks source link

Can you kindly provide a sample for php function interception? #19

Open simobgl opened 7 years ago

simobgl commented 7 years ago

That would be really interesting.

kitech commented 7 years ago

what does that "function interception" exact mean?

simobgl commented 7 years ago

To protect some of my solutions, I want to make an extension able to intercept some php functions like fopen, rename, etc. I need to be able to inspect their parameters and then fail if they try to alter/rename/create .php file whitout consent (they're hacking my sites). I have no control on code quality of all the tools and components my clients choose to use, but I want to lock specific sites and prevent hijacking.

yatsen1 wrote:

what does that "function interception" exact mean?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kitech/php-go/issues/19#issuecomment-248624828, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6z_IdMPV6xtq5W_KhGNpFCk5QeNKYkks5qsTuYgaJpZM4KBuIG.

kitech commented 7 years ago

This project just support write new php function, and will not change php's builtin functions. And now I don't known how intercept builtin function. I think this idea should be implement in another standalone project or another subject. It's should be interesting, but I think i will not support that. Any more suggestion about the idea?

simobgl commented 7 years ago

I was just liking the idea to use Go instead of C. I was hoping for something like http://php.net/manual/en/book.uopz.php, but written in Go, where I'm more fluent than C.

yatsen1 wrote:

This project just support write new php function, and will not change php's builtin functions. And now I don't known how intercept builtin function. I think this idea should be implement in another standalone project or subject. It's should be interesting, but I think i will not support that. Any more suggestion about the idea?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kitech/php-go/issues/19#issuecomment-248818628, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6z_MO81gdu22sUMcBiy43VyPdmlTXxks5qshfygaJpZM4KBuIG.

kitech commented 7 years ago

Thanks, I learn more now. I will take a look at uopz. First I think export more zend API to GO, then maybe someone can do what you want, or some other resolution.