# instanceof has higher precedence than casts

- Thread: https://externals.io/message/7876
- Original archive: https://news-web.php.net/php.internals/7876
- Started by Jan Lehnardt on 2004-02-16T14:59:53+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #7876 — Jan Lehnardt — 2004-02-16T14:59:53+00:00

URL: https://externals.io/message/7876#7876

Hi,
some dude on IRC found out that
php -r 'var_export((object)1 instanceof stdClass);';
results in
class stdClass {
   public $scalar = false;
}

IMHO it should just return true. The ZEND_ENGINE file
doesn't state anything about the precedence of instanceof.

The fix is pretty simple and a patch to zend_language_parser.y
is attached.
make test runs through fine, so I guess it doesn't brake
anything else, but I can't tell for sure of course. It
would be great if someone could look into this.

Best regards,
Jan
--
GPG Key: BB96 56B0
Q: Thank Jan? - A: http://geschenke.an.dasmoped.net/

---

## #7900 — Andi Gutmans — 2004-02-17T07:55:13+00:00

URL: https://externals.io/message/7876#7900 · In reply to: #7876

I'll take a look at it. The patch seems to be OK.

Thanks,

Andi

At 03:59 PM 2/16/2004 +0100, Jan Lehnardt wrote:
>Hi,
>some dude on IRC found out that
>php -r 'var_export((object)1 instanceof stdClass);';
>results in
>class stdClass {
>   public $scalar = false;
>}
>
>IMHO it should just return true. The ZEND_ENGINE file
>doesn't state anything about the precedence of instanceof.
>
>The fix is pretty simple and a patch to zend_language_parser.y
>is attached.
>make test runs through fine, so I guess it doesn't brake
>anything else, but I can't tell for sure of course. It
>would be great if someone could look into this.
>
>Best regards,
>Jan
>--
>GPG Key: BB96 56B0
>Q: Thank Jan? - A: http://geschenke.an.dasmoped.net/

---

## #8078 — Andi Gutmans — 2004-02-23T08:40:43+00:00

URL: https://externals.io/message/7876#8078 · In reply to: #7876

Applied.
Thanks,

Andi

At 15:59 16/02/2004 +0100, Jan Lehnardt wrote:
>Hi,
>some dude on IRC found out that
>php -r 'var_export((object)1 instanceof stdClass);';
>results in
>class stdClass {
>   public $scalar = false;
>}
>
>IMHO it should just return true. The ZEND_ENGINE file
>doesn't state anything about the precedence of instanceof.
>
>The fix is pretty simple and a patch to zend_language_parser.y
>is attached.
>make test runs through fine, so I guess it doesn't brake
>anything else, but I can't tell for sure of course. It
>would be great if someone could look into this.
>
>Best regards,
>Jan
>--
>GPG Key: BB96 56B0
>Q: Thank Jan? - A: http://geschenke.an.dasmoped.net/
