Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove unnecessary usage of CONST_CS #9685

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

Merged
cmb69 merged 11 commits into php:master from jorgsowa:remove-usage-const-cs-1
Nov 28, 2022
Merged

Conversation

Copy link
Contributor

@jorgsowa jorgsowa commented Oct 6, 2022
edited
Loading

Hello everyone,
this PR removes the majority of the usage of the CONST_CS in trivial cases which is not necessary anymore.

Kind regards

cmb69 reacted with thumbs up emoji
Copy link
Contributor

#define CONST_CS 0 /* No longer used -- always case sensitive */

This seems to work correctly - the build/gen_stubs.php script also seems to omit CONST_CS in new arginfo stubs

Not related to this PR specifically, but speaking of which

  1. CONST_CS could document that it stopped being used in PHP 8.0
  2. A review comment on https://github.com/php/php-src/pull/9439/files - https://wiki.php.net/rfc/case_insensitive_constant_deprecation only took effect in php 8.0? But the build/gen_stubs.php script is also used by PECLs, many of which still also support PHP 7.4 or older (which still has security support) - Not even $fileInfo->generateLegacyArginfoForPhpVersionId for 70000 seems like it would emit code with CONST_CS
cmb69 reacted with thumbs up emoji

CLSCTX ctx = CLSCTX_SERVER;
HRESULT res = E_FAIL;
int mode = COMG(autoreg_case_sensitive) ? CONST_CS : 0;
int mode = 0;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should just inline that 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I changed this. We can also simplify function php_com_import_typelib with the removal of CONST_CS, but I'm now learning how PHP source code works and don't want to rush.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you! I don't think that we can simplify php_com_import_typelib, since the mode is checked there for CONST_PERSISTENT which is still supported.

Copy link
Member

cmb69 commented Oct 10, 2022

Thank you! I'm in favor of dropping the use of CONST_CS; I'm not sure about it's definition (wrt. external extensions).

Copy link
Member

To be honest, I think the majority of the changes are unnecessary, since the CONST_CS usages will occasionally be gone anyway during the migration to stubs.

In my opinion, it's ok to remove the CONST_CS constant itself in PHP 8.3, since PHP 8.2 already started to get rid of most of the usages in php-src at least. In any case, we could add an upgrading note to PHP 8.2 about the deprecation of the flag.

Copy link
Contributor Author

@kocsismate, thanks for review. I didn't realize that you already remove this constant. I close my branch then. :)

Copy link
Member

No, you don't have to close this pr 🙂 some of the usages can still be removed!

cmb69 reacted with thumbs up emoji

Copy link
Contributor Author

@kocsismate , I'm sorry, but I didn't understand. I thought that my changes are necessary, because you will cover it during your migration to stubs as you did inside this PR: #9731

I'm still not well oriented in PHP source code and I didn't remove all the cases at once. Just the trivial once to not break anything. If you need any help of me with migration then I would be glad to help.

Copy link
Member

cmb69 commented Oct 13, 2022

@jorgsowa, the changes directly relating to REGISTER_*_CONSTANT will be covered by the migration by stubs (@kocsismate already covered at least some of these during the last days). But there are some other changes (e.g. the one to ext/com_dotnet) which should be applied on top of that. I'm re-opening this ticket as a reminder. :)

@cmb69 cmb69 reopened this Oct 13, 2022
Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

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

Thank you! This looks mostly good to me (I left some comments), but maybe @kocsismate wants to have a look, too.

@cmb69 cmb69 merged commit 77ee92a into php:master Nov 28, 2022
Copy link
Member

cmb69 commented Nov 28, 2022

Thank you!

@jorgsowa jorgsowa deleted the remove-usage-const-cs-1 branch June 26, 2023 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@cmb69 cmb69 cmb69 left review comments

@kocsismate kocsismate kocsismate approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /