# Using extract() with $this

- Thread: https://staging.externals.io/message/105649
- Original archive: https://news-web.php.net/php.internals/105649
- Started by Craig Duncan on 2019-05-08T21:16:18+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://staging.externals.io/search.md?q={query} · RFCs at https://staging.externals.io/rfc.md · JSON API at https://staging.externals.io/api · documentation at https://staging.externals.io/llms.txt

---

## #105649 — Craig Duncan — 2019-05-08T21:16:18+00:00

URL: https://staging.externals.io/message/105649#105649

Hi everyone,

I've just opened a pull request for some changes to *extract()* handling of
*$this*
https://github.com/php/php-src/pull/4133

I had a look through the original RFC discussion, and it looks like
 `extract()` was brought up and then quickly handled, but it seems like the
handling was a bit over the top.
https://externals.io/message/93457

As reported in the below bug, `extract()` throws an exception when the
documentation suggests that it should be able to handle the scenario
(either by ignoring the request to overwrite *$this* or by creating a
prefixed version of it).
https://bugs.php.net/bug.php?id=77135

The only one I'm unsure of is the *IF_EXISTS* flags, as *$this* isn't in
the symbol table it's ignored even though technical *$this* does exist. But
as this is the current behaviour and doesn't cause an issue I thought for
BC it would be best to leave this behaviour alone.

Does anybody disagree with this change? Does it need an RFC?

---

## #105652 — Nikita Popov — 2019-05-09T14:11:36+00:00

URL: https://staging.externals.io/message/105649#105652

> Hi everyone,
>
> I've just opened a pull request for some changes to *extract()* handling of
> *$this*
> https://github.com/php/php-src/pull/4133
>
> I had a look through the original RFC discussion, and it looks like
> `extract()` was brought up and then quickly handled, but it seems like the
> handling was a bit over the top.
> https://externals.io/message/93457
>
> As reported in the below bug, `extract()` throws an exception when the
> documentation suggests that it should be able to handle the scenario
> (either by ignoring the request to overwrite *$this* or by creating a
> prefixed version of it).
> https://bugs.php.net/bug.php?id=77135
>
> The only one I'm unsure of is the *IF_EXISTS* flags, as *$this* isn't in
> the symbol table it's ignored even though technical *$this* does exist. But
> as this is the current behaviour and doesn't cause an issue I thought for
> BC it would be best to leave this behaviour alone.
>
> Does anybody disagree with this change? Does it need an RFC?
>

These changes sound reasonable to me. I don't think it needs an RFC -- this
is more of a bug fix.

Nikita
