Re: Re: Problems with the fix for the BC break introduced in 5.4.29 and 5.5.13
| From: | Stas Malyshev | Date: | Thu, 19 Jun 2014 09:05:38 +0000 |
| Subject: | Re: Re: Problems with the fix for the BC break introduced in 5.4.29 and 5.5.13 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74985@lists.php.net to get a copy of this message | ||
Hi!
> The use case I am interested is test doubles. When I create a stub
> or mock of a class then I do not wants its original functionality to
> be executed. I just want to have an object that looks like an object
> of the original class. When the original functionality is not executed,
> though, how can we run into a segfault when the constructor of an
> internal class is not executed?
Dtors would be one thing. But another thing is that we can not ensure no
method of original class would be ever called - even with mocking, etc.,
as most mocks do not override every method of the class, and even if
they do there are handlers that can not be overridden from userspace, so
if those are set and expect certain values be there they can be
activated by third-party code which has no idea it's dealing with the
mock. So we'd have a ticking bomb on our hands.
So I'm not sure there is such thing as creating an internal object
without calling its ctor or doing something else that initializes it.
I understand why people may want to do it, but I don't think it can
safely be done for internal objects. Unless somebody has some bright
ideas that I have missed.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227