Skip to content

Php8 comp #528

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
merged 3 commits into from
Jan 31, 2023
Merged

Php8 comp #528

merged 3 commits into from
Jan 31, 2023

Conversation

lifenglsf
Copy link
Contributor

修复php8,stdint.h文件变化,php8.2使用系统的stdint.h

@lifenglsf lifenglsf mentioned this pull request Jan 4, 2023
#else
# include "win32/php_stdint.h"
#endif
#if (defined(_MSC_VER) && _MSC_VER<=1920)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is defined by the Microsoft C compiler version. Can you point to a document explaining why this is the right variable to use to switch which header to include?

Copy link
Contributor Author

@lifenglsf lifenglsf Jan 10, 2023

Choose a reason for hiding this comment

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

for this commit,php removed php_stdint.h file

Copy link
Contributor

Choose a reason for hiding this comment

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

Found it: https://github.com/php/php-src/blob/PHP-8.2/UPGRADING.INTERNALS#L26

But I still don't understand why the MSC_VER is the right way to determine whether to use the win32 header variant. Isn't the issue here that the PHP version needs to be checked for >= 80200?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, it's probably best to check for the PHP version only; in theory, <stdint.h> might not be available (i.e. for very old MSVC/SDKs), but in practice this can be ignored.

Copy link
Contributor Author

@lifenglsf lifenglsf Jan 12, 2023

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I just realize that this is actually about win32/php_stdint.h which is removed as of PHP 8.0.0 (I thought it is about main/php_stdint.h which is removed as of PHP 8.2.0 only). So, I don't understand why there should be any change at all. Apparently, standard Windows builds for PHP 8.0 and 8.1 are successful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to less if else condition

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, simplification is nice, and compatibility with PHP 8.2.0 is important. But why not:

 php_memcached_private.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/php_memcached_private.h b/php_memcached_private.h
index b4b1115..2d67e36 100644
--- a/php_memcached_private.h
+++ b/php_memcached_private.h
@@ -48,11 +48,11 @@
 #include <ext/standard/basic_functions.h>
 
 #ifdef PHP_WIN32
-  #  if PHP_VERSION_ID >= 80000
-  #  include "php_stdint.h"
-#else
-# include "win32/php_stdint.h"
-#endif
+# if PHP_VERSION_ID >= 80000
+#  include <stdint.h>
+# else
+#  include "win32/php_stdint.h"
+# endif
 #else
 /* Used to store the size of the block */
 #  if defined(HAVE_INTTYPES_H)

This is basically the same as your suggestion, but checking for PHP_VERSION instead of _MSC_VER.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok,good suggestion.i'll modify it.

Copy link
Contributor

Choose a reason for hiding this comment

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

thank you, I'm keeping an eye out for the PR update!

@remicollet
Copy link
Collaborator

Perhaps @cmb69 may help on this ?

@sodabrew
Copy link
Contributor

sodabrew commented Jan 18, 2023

Sidenote: It occurs to me that GitHub Actions offers Windows builds, that might be helpful to put into the matrix.

Edit: I totally missed #532 submitted last week!

@sodabrew
Copy link
Contributor

sodabrew commented Jan 18, 2023

Just merged #532 adding Windows CI to the build matrix. Could you a) rebase, b) adjust per @cmb69 suggestions? I agree strongly that unless there's a specific compiler workaround required for MSVC, we should go with something like ifdef PHP_WIN32 and PHP_VERSION >= 8xxx to select the appropriate header file that comes with that version of PHP.

@sodabrew
Copy link
Contributor

Should it be >= 80200 instead of 80000? There are still some uses of u_char in 8.0 - 8.1 that were fully removed before 8.2.0, e.g. php/php-src#8611 which was the purpose of the prior main/php_stdint.h header.

@cmb69
Copy link
Contributor

cmb69 commented Jan 31, 2023

php_stdint.h is removed as of PHP 8.2.0, but win32/php_stdint.h is already removed as of PHP 8.0.0. So unless you want to have three cases, >=80000 looks good to me.

@sodabrew sodabrew merged commit 1eac9f8 into php-memcached-dev:master Jan 31, 2023
@sodabrew
Copy link
Contributor

Thank you @lifenglsf and everyone who helped me understand the background on this PR!

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.

4 participants