HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
"_Override" magic method
ddumont
✭✭
When you do this, are you passed the overridden function so that you can call it for some default behavior?
Also, do you know if you can "un-echo" stuff with php or otherwise modify the output buffer?
For example, override a method to change the input it gets called with (by calling it yourself) and then go fix up markup that it printed.
Also, do you know if you can "un-echo" stuff with php or otherwise modify the output buffer?
For example, override a method to change the input it gets called with (by calling it yourself) and then go fix up markup that it printed.
There was an error rendering this rich post.
Tagged:
0
Best Answer
-
Todd Vanilla StaffIn an override method you are given a reference to the object that you are overriding, so you can call the original method yourself on
$Sender
.
PHP has an output buffer and it works like a stack. So if you callob_start()
then echo a bunch of stuff then callob_get_clean()
you will get everything in the output buffer from your call toob_start()
, but you'll leave the rest of the output buffer intact. Really good implementation actually.0
Answers
$Sender
.PHP has an output buffer and it works like a stack. So if you call
ob_start()
then echo a bunch of stuff then callob_get_clean()
you will get everything in the output buffer from your call toob_start()
, but you'll leave the rest of the output buffer intact. Really good implementation actually.There was an error rendering this rich post.
@ddumont & @Todd
Are we talking about Magic Event or Magic Method?
Seriously, Magic Method got override capability?
Override should be a last resort, monkey patch.
grep is your friend.