-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
fix: [PHP] add missing reserved classnames #9458
fix: [PHP] add missing reserved classnames #9458
Conversation
@acozzette I fixed the tests - I missed adding them to the |
@acozzette okay they're really fixed this time I promise! |
Thanks, @bshaffer. |
@acozzette my pleasure! Thanks for the quick review. Do you know when this fix will be available in a release? |
I'm hoping we can do a release next week, but I need to check with the rest of the team on that. We will likely do a release by the end of next month at the latest, but hopefully sooner than that. |
Got this error:
19 12.77 /tmp/pear/temp/pear-build-defaultuserjglifJ/protobuf-3.20.0/libtool: line 1290: can't create third_party/utf8_range/naive.loT: nonexistent directory |
👋 I just noticed
I've already raised an issue with them: php/doc-en#1518 |
Object it isn't a reserved class name. It is a reserved word and comes with broader restrictions than just as a class name. |
Hey @damianwadley, sorry for the confusion. I suppose being a reserved word makes the In this particular case, protobuf is generating a class called |
Protobuf generates class with the name
Parent
in PHP (see this PR). This is an invalid class name, and results in a fatal error. The same is true for the wordself
:https://www.php.net/manual/en/reserved.classes.php
Our current list represents PHP "keywords", which have almost the same restrictions in PHP, but are slightly more restricted:
https://www.php.net/manual/en/reserved.keywords.php
The difference here is keywords cannot be used in global functions or constants. As protobuf for PHP does not generate any global functions or constants, they can be treated as the same, and do not need special treatment (such as
kReservedClasses
).This is not a backwards-compatibility breaking change, as any protobuf objects with the names
self
orparent
would be throwing PHP fatal errors if generated today.