Skip to content
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

Allow passing a second argument to gettype to resolve class names #5142

Closed
wants to merge 1 commit into from

Conversation

markrandall
Copy link

No description provided.

Adding blessed changes

Replaced spaces with tabs

Return zend_string without intern

Returning copy of name
ZEND_PARSE_PARAMETERS_END();

if (resolve_object_names && Z_TYPE_P(arg) == IS_OBJECT) {
RETURN_STR_COPY(Z_OBJ_P(arg)->ce->name);
Copy link
Member

@kocsismate kocsismate Feb 2, 2020

Choose a reason for hiding this comment

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

One gotcha I see with this solution is the ambiguous result when a resource class instance is passed to get_type(). See https://3v4l.org/5aEd2 for example. I admit though that this is an edge case (and maybe resource should be reserved independently from this PR?).

@markrandall
Copy link
Author

markrandall commented Feb 2, 2020

Possible alternative would be another function, maybe describe_type which would give int / float / bool / object(classname) / resource(resname) ?

CC @beberlei

@nikic
Copy link
Member

nikic commented Feb 2, 2020

Please add a new function, as you'll also want to fix the returned type names.

@markrandall
Copy link
Author

Implemented as new function in #5143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants