tag:blogger.com,1999:blog-36547168.post5139817179215765814..comments2023-11-25T11:00:42.257+01:00Comments on Invisible to the eye: Monkey patching in PHPGiorgiohttp://www.blogger.com/profile/03558287012747987157noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-36547168.post-22701734566052863322010-10-03T18:24:55.253+02:002010-10-03T18:24:55.253+02:00There is runkit extension for true monkey patching...There is runkit extension for true monkey patching: http://www.php.net/manual/en/intro.runkit.phpAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-36547168.post-8656445097108322412010-10-03T10:09:56.858+02:002010-10-03T10:09:56.858+02:00To show the code actually executed (with the addit...To show the code actually executed (with the addition of the namespace). Not necessary, but explanatory. :)Giorgiohttps://www.blogger.com/profile/12689416577856305650noreply@blogger.comtag:blogger.com,1999:blog-36547168.post-15437874639463771842010-10-02T19:57:04.370+02:002010-10-02T19:57:04.370+02:00Why the 'echo' before the 'eval'?Why the 'echo' before the 'eval'?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-36547168.post-43915279239275704122010-10-02T11:16:24.001+02:002010-10-02T11:16:24.001+02:00There are many reasons for avoiding monkey patchin...There are many reasons for avoiding monkey patching:<br />http://en.wikipedia.org/wiki/Monkey_patch#Pitfalls<br />However, the greatest issue for me is the global state modifications implied by monkey patching and the Action at a distance anti-pattern that results. Once you start modifying the library functions, code in other modules and classes will began to work differently. This article describes a way to use the seam at loading/compile time, but it seems pretty dangerous nonetheless: think about one programmer unaware of the patching going on who sees this output: he would never question the correctness of a PHP function, leading to an awful debugging session...Giorgiohttps://www.blogger.com/profile/12689416577856305650noreply@blogger.comtag:blogger.com,1999:blog-36547168.post-26061244749542702192010-10-01T16:39:56.219+02:002010-10-01T16:39:56.219+02:00You really should give a better explanation of why...You really should give a better explanation of why one shouldn't do this. There are a handful of places where monkey patching is appropriate and if you are going to give advice as to whether people should or shouldn't engage in a practice then you should give a good (read well supported) reason for it.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-36547168.post-7274982171271921602010-10-01T11:36:30.617+02:002010-10-01T11:36:30.617+02:00Also, for purposes of testing legacy code, it seem...Also, for purposes of testing legacy code, it seems like a very nice seam.fqqdkhttps://www.blogger.com/profile/17736847701391219927noreply@blogger.comtag:blogger.com,1999:blog-36547168.post-1364685941027725222010-09-30T14:37:34.584+02:002010-09-30T14:37:34.584+02:00there's a discussion on the grusp mailing list...there's a discussion on the grusp mailing list defining when monkey patching is a good practiceAnonymousnoreply@blogger.com