Problem/Motivation

In #1543858: Add a startup configuration for the built-in PHP server that supports clean URLs we add configuration for PHP's inbuilt webserver to work with clean URLs. Unfortunately this configuration does not support update.php

Proposed resolution

Make it support it.

Steps to test/reproduce

  1. Install standard
  2. Execute $ php -S localhost:8888 .ht.router.php from the command line from DRUPAL_ROOT
  3. Visit http://localhost:8888/update.php
  4. Click on the continue button
  5. Ensure that admin/structure/types/manage/article/fields/node.article.body is not broken since this is why with the script in the first place - see https://bugs.php.net/bug.php?id=61286
  6. Ensure that http://localhost:8888/update.php/selection/blahd.blah
  7. falls back to an update screen since this is the behaviour on Apache.

  8. Go to node/add/article
  9. Create a node with an image uploaded
  10. Ensure the image appears

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
FileSize
836 bytes

Here's a patch that fixes it.

chr.fritsch’s picture

I was able reproduce the issue and can confirm that #2 fixes it.

alexpott’s picture

Issue summary: View changes
FileSize
2.31 KB
2.2 KB

Here's a better fix with support for things other than update.php.

The last submitted patch, 2: 2929198-2.patch, failed testing. View results

alexpott’s picture

Issue summary: View changes

Testing has shown that #3 breaks image styles :(

Here is a fix.

alexpott’s picture

alexpott’s picture

We can limit the amount of file system checking by just looking for paths that end in .php

alexpott’s picture

Further testing of the equivalent Drush command has shown that this needs a small tweak.

alexpott’s picture

Worked out a nicer way with way less conditionals and probably quicker to boot too.

The last submitted patch, 7: 2929198-5.patch, failed testing. View results

alexpott’s picture

Just to note that Thunder is now successfully using this patch to spin up a server using PHP in travis testing.

dawehner’s picture

  1. +++ b/.ht.router.php
    @@ -30,10 +30,26 @@
    +// Work around the PHP bug.
    ...
    +if (strpos($path, '.php') !== FALSE) {
    

    Is this a PHP bug we can link to?

  2. +++ b/.ht.router.php
    @@ -30,10 +30,26 @@
    +    if (preg_match('/\.php$/', $path) && is_file('.' . $path)) {
    

    I'm curious, is there a reason why we use a regex instead of a strpos?

alexpott’s picture

1. The PHP bug is already linked in the file. See https://github.com/drupal/drupal/blob/8.5.x/.ht.router.php
2. Yep because I wanted to ensure that it was a .php file so the $ is significant.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs manual testing

2. Yep because I wanted to ensure that it was a .php file so the $ is significant.

I was trying to apply some microoptimization, sorry.

1. The PHP bug is already linked in the file. See https://github.com/drupal/drupal/blob/8.5.x/.ht.router.php

Oh right, thank you!

This no longer needs manual testing.

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

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

catch’s picture

Version: 8.6.x-dev » 8.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.6.x and cherry-picked to 8.5.x. Thanks!

  • catch committed 74d9b41 on 8.6.x
    Issue #2929198 by alexpott: .ht.router.php does not support update.php
    

  • catch committed 0b2d458 on 8.5.x
    Issue #2929198 by alexpott: .ht.router.php does not support update.php...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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