Add curl as required extension; refactor how dependency errors are communicated#2183
Add curl as required extension; refactor how dependency errors are communicated#2183westonruter merged 1 commit intodevelopfrom
Conversation
That paragraph is a bit long. Took me a second to realize these are all different issues that need to be handled individually. Perhaps we could list them on separate lines?
Nice! Apart from that: I was wondering if we could somehow use the WP HTTP API with FasterImage, removing the absolute requirement for cURL. |
@swissspidy How about like this:
I've thought about that, but the problem is |
|
I suppose each subsequent error line in WP-CLI should have a bullet point. |
|
Much better already, thanks! Since the extension list is a bit repetitive, what about something like this: $extensions = array_map(
function ( $ext ) {
return "<code>{ $ext }</code>";
},
$extensions
);
sprintf(
_n(
'The following PHP extension is missing: %s. Please contact your host ...',
'The following PHP extensions are missing: %s.Please contact your host ...',
count( $extensions ),
'amp'
),
implode( ', ', $extensions )
); |
09ec7af to
243a9ef
Compare
|
Looks great! 😻 |
|
Cherry-picked onto 1.1 branch: 5a9c98e |
| 'insufficient_php_version', | ||
| sprintf( | ||
| /* translators: %s: required PHP version */ | ||
| __( 'The AMP plugin requires PHP %s; please contact your host to update your PHP version.', 'amp' ), |
There was a problem hiding this comment.
Just noticed this. We should turn this semicolon into a dot again in order to not make existing translations fuzzy.
…on-string Revert PHP version error message translation string from #2183
…es-redux * 'develop' of github.com:ampproject/amp-wp: Switch order of view/validate links AMP admin bar item depending on context Add 'View AMP' link to admin bar in Reader mode; add admin bar link for non-admin users Prevent inline styles on images from overriding required display for layout Revert PHP version error message translation string from #2183 Remove unused FALLBACK_HEIGHT constants Remove invalid layout=intrinsic option from video block Inject width/height attributes into video elements from the Video block
|
Hi, |
|
@mehrdadabed Hello, I have some questions for you:
How are you blocking the function? Are you using a forked version of the cURL extension or some other means to prevent access to this function? I was curious if this function would specifically be a problem for DDoS attacks. I was thinking that the non-blocking HTTP requests that WordPress makes normally for cron could be used in almost the same way as cURL Multi. I created a script to test, and it seems indeed that cURL multi is able to make requests at 3⨉ the rate of non-blocking cURL. Even so, is 3⨉ is not 30⨉. So disabling cURL Multi only seems to help marginally, not on the order of magnitudes. So is it still worthwhile?
See also conversation on #1809. We dropped support for non-multi requests as we assumed that it was available in all PHP 5.4 installations. You are on PHP 5.4+ and yet have this function disabled? Is this a common practice among hosts? It's the first I've seen a report of it. Are sites you host currently getting PHP server errors due to this function not existing? At the very least, what we need to do here is check not only if the cURL extension is installed but also we need to check if the Otherwise, if this is indeed a common scenario, we may need to bring back /cc @felixarntz |
|
@westonruter you can hopefully disabled functions with I get error 500 with function disabled and this in log :
|
|
OK, I've opened #2319 to check for the required functions and classes in addition to the required extensions. This will at least prevent a fatal error on your server and will inform the user of what is missing. I believe the ultimate fix for you is going to be for |
|
Hi and thanks for the answer, |
|
Please follow willwashburn/fasterimage#16 the resolution. |
|
FasterImage has been updated with the fallback support. Merged update into AMP plugin: #2422 So this will be part of 1.1.2, perhaps released today. |
|
@mehrdadabed Please test: #2423 |




Someone reported fatal errors due to the
curl_multi_init()function not existing. This appears due to thecurlextension not being loaded. So this PR adds a check forcurlbeing installed.Extensions are also now checked for being loaded, rather than feature detecting classes and functions.
Additionally, there was a lot of duplicated code in the logic for rendering the dependency errors. So this PR refactors the logic not only to remove the duplication but to ensure that all dependency errors are shown together, instead of one-by-one.
For example, if installing the plugin from source and not having done a build, while also the
curlextension is not installed, the user is shown the following admin notice:And now as well there is a warning that is shown when interacting with WP-CLI: