Re: Re: Problems with the fix for the BC break introduced in 5.4.29 and 5.5.13
| From: | Julien Pauli | Date: | Thu, 19 Jun 2014 08:42:49 +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-74983@lists.php.net to get a copy of this message | ||
On Thu, Jun 19, 2014 at 8:07 AM, Sebastian Bergmann <sebastian@php.net> wrote:
> Am 19.06.2014 00:22, schrieb Stas Malyshev:
>> How we can safely make that? For internal classes I'm afraid making them
>> work safely without ctor would be a challenge - after all, all the code
>> expects ctor to run. For user classes at least the engine would throw a
>> fatal error at worst, but for internal classes we'd get segfaults all
>> over the place. I'm not sure how this can be done safely.
>
> 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?
Because you'll need an object, so you'll need to create it.
Internal classe based objects may have some more logic that just
executing their userland's __construct() , that's the case for
SplFileObject and many other ones (date, xml ...).
Internal class based objects have an internal constructor which is
expected to be called (the create_object() handler).
It has never been planned for this internal constructor not to be called.
Julien.P