Skip to content

Fix #79749: Converting FFI instances to bool fails #5776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Jun 29, 2020

Casting objects to bool is supposed to yield true. Since the
cast_object handler is required now, we have to implement the
_IS_BOOL conversion there.

Casting objects to bool is supposed to yield `true`.  Since the
`cast_object` handler is required now, we have to implement the
`_IS_BOOL` conversion there.
ext/ffi/ffi.c Outdated
@@ -4640,9 +4643,15 @@ static HashTable *zend_fake_get_gc(zend_object *ob, zval **table, int *n) /* {{{
}
/* }}} */

static int zend_fake_cast_object(zend_object *obj, zval *result, int type)
static int zend_cast_object(zend_object *obj, zval *result, int type)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the rename?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it isn't a fake cast anymore, is it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still seems to be pretty fake to me ^^ zend_cast_object sounds like how the standard object handler would be called. (I guess the problem here is more that all of this is prefixed by zend_ for some reason, even though it has nothing to do with ZE.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, seen this way, the renaming was a bad idea. Thanks!

@cmb69 cmb69 added the Bug label Jun 29, 2020
The former name may easily be confused with a ZE standard object cast.
@cmb69
Copy link
Member Author

cmb69 commented Jun 29, 2020

Thanks! Applied as aca621c.

@cmb69 cmb69 closed this Jun 29, 2020
@cmb69 cmb69 deleted the cmb/79749 branch June 29, 2020 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants