-
Notifications
You must be signed in to change notification settings - Fork 8k
Remove HAVE_* for always available extensions #3912
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
Remove HAVE_* for always available extensions #3912
Conversation
|
Yes, I think having these constants defined doesn't make sense anymore. Same can be probably done for date, hash, spl. It maybe is weird to define something that is always there but I'm not sure how this affects writing extensions where for example something is checking if reflection is present and suddenly that won't be defined anymore. I'm not sure what is more logical in this case, so if you think that this should be dropped, I think it's ok and we add it also to the UPGRADING.INTERNALS... |
|
Like @petk said, it is fine to do for all the always enabled extensions if there is any similar constants |
|
SPL, Reflection, Standard, Date, Hash, PCRE, any other extension that is built by default and can't be disabled? |
|
I think these are it, yes. In reality the filter and readline are also a bit difficult to disable and build as shared but that's nothing related to this issue... |
|
Removing the |
|
I'm not sure if this was in the past defined as BC break since it only concerns extension developers... For the ZIP extension notice also the if else check where it will apply for PHP 5.6 for example. For PHP < 7 versions SPL was maybe missing. So on PHP 7.4 it won't even reach that part. But yes these might be in the extensions out there. We can also add that in the UPGRADING.INTERNALS so the extension authors can upgrade them properly when adjusting for PHP-7.4+... |
|
It seems reasonable to remove them to me. There are extensions out there
targeting both PHP 5 and 7 in the same source, but it's not too much effort
to check the version, and they'll be likely making changes for 7.4 anyway.
Adding info to upgrading seems sufficient then.
…On Sun, 3 Mar 2019 at 21:14, Peter Kokot ***@***.***> wrote:
I'm not sure if this was in the past defined as BC break since it only
concerns extension developers... For the ZIP extension notice also the if
else check where it will apply for PHP 5.6 for example. For PHP < 7
versions SPL was maybe missing. So on PHP 7.4 it won't even reach that
part. But yes these might be in the extensions out there. We can also add
that in the UPGRADING.INTERNALS so the extension authors can upgrade them
properly when adjusting for PHP-7.4+...
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3912 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACIe6rFyK6dVKzsLEESj_TmNfUsGrdH9ks5vTC0rgaJpZM4bbLlN>
.
|
Since PHP 5.3.0 the SPL extension has always been available, I think it is fair to assume that code that does cross compilation over multiple PHP versions do not support so far back so I cannot see it being an issue and developers can therefore check for such. Edit: Optionally you can provide a patch for the ZIP extension to use such a check, which I think @remicollet would gladly accept |
| ADD_SOURCES("ext/pcre/pcre2lib", "pcre2_auto_possess.c pcre2_chartables.c pcre2_compile.c pcre2_config.c pcre2_context.c pcre2_dfa_match.c pcre2_error.c pcre2_jit_compile.c pcre2_maketables.c pcre2_match.c pcre2_match_data.c pcre2_newline.c pcre2_ord2utf.c pcre2_pattern_info.c pcre2_serialize.c pcre2_string_utils.c pcre2_study.c pcre2_substitute.c pcre2_substring.c pcre2_tables.c pcre2_ucd.c pcre2_valid_utf.c pcre2_xclass.c pcre2_find_bracket.c pcre2_convert.c pcre2_extuni.c", "pcre"); | ||
| ADD_DEF_FILE("ext\\pcre\\php_pcre.def"); | ||
|
|
||
| AC_DEFINE('HAVE_BUNDLED_PCRE', 1, 'Using bundled PCRE library'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we can drop this one as well
ext/mbstring/mbstring.c
Outdated
| # include <oniguruma.h> | ||
| # undef UChar | ||
| #elif HAVE_PCRE || HAVE_BUNDLED_PCRE | ||
| #elif HAVE_BUNDLED_PCRE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed entirely instead. if HAVE_PCRE || HAVE_BUNDLED_PCRE => if 1 => always true.
ext/session/php_session.h
Outdated
| #include "ext/standard/php_var.h" | ||
|
|
||
| #if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH) | ||
| #if !defined(COMPILE_DL_HASH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if should also be completely dropped.
|
I'd recommend keeping HAVE_HASH_EXT because it is only recently required and HAVE_PCRE, because I think there's quite a lot of ext code (unnecessarily) checking for |
|
@nikic I believe PCRE has been a special extension since 5.3 as well, so I think it should be removed instead, even if their checks is unnecessary. We should label it as such in the For ext/hash, I think we should keep the check for now, at least until 8.0. Alternatively we can keep defines until 8.0 to ease 7.x extensions (my personal preference). |
@KalleZ since this won't be merged lower than 7.4, and 7.4 is going to be the last in 7 series, I would say it's not a really big deal to just remove defines that can be removed now, excluding hash, hash one should be removed in master to ease the 8 upgrade (likely already ifdefs for 80000) |
|
@krakjoe I’m fine with that approach |
|
Looks like removing some of these extensions isn't trivial: https://ci.appveyor.com/project/php/php-src/builds/23120735/job/rpqc5sc0ikuqe00s#L624. I'll only remove from SPL, Reflection, and Date for now. |
|
@carusogabriel I wrote this quick patch for PCRE (for current master), you can adapt into this PR: https://gist.github.com/KalleZ/08feb65ca07e8d9ffd4babd90f628ef2 Notes:
Edit: As of this edit, I updated the patch to omit the changes to |
|
@KalleZ Thanks for the patch. I'll update this PR with that, so we can deliver it 🚢 |
|
@carusogabriel I synced Edit: Removed |
The PHP SPL extension is always available in PHP since somewhere around PHP 5.3. The HAVE_SPL constant has been removed upstream via php/php-src#3912
|
This is awful and you are breaking extensions by doing this, causing some (like memcached as noted by the pull request above) to fall back to old / disabled behavior. Even if I accept the PR to the memcached extension promptly and cut a release right away, if someone compiles an older extension against PHP 7.4 it would behave badly in a new way. (Granted there is a version check in the peck xml, I don’t recall how strongly enforced this is if a user forces the installation or worse, if an automated installer wrapper script forces it.) So here’s what I propose: redefine these HAVE_* constants in a way that generates a compiler warning or even an error. Use this to give notice that PHP 8 will remove the constants. |
|
I was just listening to @derickr and @krakjoe (https://derickrethans.nl/phpinternalsnews-16.html) and basically there is also mentioned that ABI can be broken from PHP 7.3 to 7.4 in ways of BC. Otherwise, I understand the frustration. Sort of... I'm not sure entirely how would that work with the error happening on the compilation step... To me it sounds a bit bloated but that's how this really should be solved, yes. Breaking API on the other hand is the most awful thing. More than ABI. Semantic versioning in ideal world would be essential to follow. Case is that C ecosystem is not ideal world. Far away from it. But PHP world should be approximation of the ideal world. Or at least we should try in such direction. I'm scanning the PHP extensions periodically, no worries. It's not that bad situation with these HAVE_* symbols as one might think. There were bigger ABI BC breaks done in PHP 7.4 I think. Currently all extensions (at least the alive ones) have received the pull requests to fix this HAVE_SPL symbol. The memcached extension in particular has from my current state, all fixed except the HAVE_SPL. Hope we can make it... Regards. |
|
I had something like these in mind: But both of these just return true for |
|
@sodabrew very nice. My C-foo is not there yet to suggest a way here to produce such errors when compiling. There are even multiple compilers then used... Otherwise this would be really neat trick. Depends also if there is some impact on performance of the overall code... |
As the Reflection extension now builds by default and can't be disabled, these isn't necessary.