Skip to content

Add support for defining object constants via define() #7243

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 1 commit into from

Conversation

kocsismate
Copy link
Member

Hopefully, I'm not missing any conceptual problem why the original RFC left this use-case out.

@@ -444,6 +440,13 @@ static bool validate_constant_array_argument(HashTable *ht, int argument_number)
}
/* }}} */

static bool validate_constant_obj_argument(zend_object *obj)
Copy link
Member Author

Choose a reason for hiding this comment

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

clearly, this is just a placeholder :( I'm not sure what should be validated

@@ -520,11 +523,10 @@ ZEND_FUNCTION(define)
val = &val_free;
break;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

the if above seems a bit problematic, since either BC or consistency is harmed, either it is removed, or left as-is.


if (!validate_constant_obj_argument(Z_OBJ_P(val))) {
RETURN_THROWS();
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm sure we need some custom code here, just like arrays do

@nikic
Copy link
Member

nikic commented Jul 14, 2021

See also #7149 and https://externals.io/message/114863. The discussion was positive, but I forgot to actually commit the change.

@kocsismate
Copy link
Member Author

See also #7149 and https://externals.io/message/114863. The discussion was positive, but I forgot to actually commit the change.

Thanks! In this case, I'm closing this PR, but I directly committed the stub change.

@kocsismate kocsismate closed this Jul 14, 2021
@kocsismate kocsismate deleted the new-define branch July 14, 2021 20:04
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.

2 participants