This check is not relevant on the CLI and causes an error on Drush, for example.

CommentFileSizeAuthor
#12 2931883-12.patch760 bytesDavid_Rothstein
always.patch737 bytesmoshe weitzman

Comments

moshe weitzman created an issue. See original summary.

moshe weitzman’s picture

Title: Unneeded grep always_populate_raw_post_data on CLI » Unneeded always_populate_raw_post_data requirements check while on CLI
wim leers’s picture

This is because the PHP CLI has different settings, right? But then how can rest_requirements() actually require that this setting has a certain value? I think you're saying it can't?

wim leers’s picture

Status: Needs review » Postponed (maintainer needs more info)
moshe weitzman’s picture

Status: Postponed (maintainer needs more info) » Needs review

There is no such thing as a POST on a CLI request. So my patch restricts the error to just web requests.

wim leers’s picture

Right: there is no POST in CLI, because there is no HTTP in CLI. I'm not questioning that.

But this is a php.ini configuration check that's necessary for the REST module to function correctly (apparently, I'd never seen it before). My concern is that making the change you proposed means that using drush en -y rest will now not do the necessary requirements checking.

wim leers’s picture

Hm, apparently always_populate_raw_post_data is removed in PHP 7, and it never affected REST functionality, only tests. And the two affected tests no longer exist, they've been refactored away.

AFAICT this is a pure PHP bug work-around, so we should probably keep it until Drupal requires PHP >=7.

This issue is filed against Drupal 9. I think you want this to land in the next Drupal 8 minor though?

moshe weitzman’s picture

I suggest doing a hook_requirements for phase==runtime and not phase ==install. And of course, omit CLI requests per the patch.

wim leers’s picture

Version: 9.x-dev » 8.4.x-dev
Status: Needs review » Needs work

Sound good to me! I see no reason why this could not land in 8.4 already, since this is a simple bugfix with no behavioral impact on existing sites.

David_Rothstein’s picture

Hm, apparently always_populate_raw_post_data is removed in PHP 7, and it never affected REST functionality, only tests. And the two affected tests no longer exist, they've been refactored away.

If that's true, this requirements check could just be removed entirely. (But based on reading #2456025: PHP warnings in PHP 5.6 because of always_populate_raw_post_data ini setting it sounds like there might be a real effect somewhere; it is hard to tell.)

It would be nice to just remove the code - it's somewhat suspect anyway (since it enforces a particular solution which isn't even the most backwards-compatible one that the PHP developers recommend; they seem to recommend simply turning off display_startup_errors in production).

But just making it a runtime-only error (and non-CLI) does sound good as a first step.

David_Rothstein’s picture

Status: Needs work » Needs review
StatusFileSize
new760 bytes

Quick patch (untested) that just does what was suggested above (runtime-only and non-CLI).

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

LGTM, and green. Thanks.

wim leers’s picture

Assigned: moshe weitzman » Unassigned
Issue tags: +DX (Developer Experience)

RTBC++

larowlan’s picture

Version: 8.4.x-dev » 8.5.x-dev

Crediting @WimLeers as the discussion and reviews here shaped the patch

Moving to 8.5.x, as per https://www.drupal.org/core/release-cycle-overview#current-development-c... 8.4 is in 'critical fixes only', so this can't be backported to 8.4

larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed as 0428e20 and pushed to 8.5.x.

  • larowlan committed 0428e20 on 8.5.x
    Issue #2931883 by moshe weitzman, David_Rothstein, Wim Leers: Unneeded...
wim leers’s picture

@larowlan: doesn't "criticals only for current minor" start when the beta of the next minor is released?

larowlan’s picture

Hi Wim,

I checked with the release managers just to be sure, but definitely 8.4.5 will be criticals only.

Lee

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

David_Rothstein’s picture

Created a followup issue to discuss removing this check entirely.