Problem/Motivation

PHP 7 has a looming regression of parse_url we'd like to keep an eye on. The existing test fails but it would not hurt to include more character types in the usernames and passwords, especially if we are forced to roll our own. A null password should be tested as well.

Proposed resolution

TBD

Remaining tasks

Patch and review.

Comments

xjm created an issue. See original summary.

Mixologic’s picture

Our containers are built against the PHP-7.0 branch of php on github.

https://github.com/php/php-src/commits/PHP-7.0

xjm’s picture

Apparently this run was 7.0.13-dev:

14:09:36 php -v
14:09:36 Command created as exec id a37007bb
14:09:36 PHP 7.0.13-dev (cli) (built: Oct  6 2016 23:35:15) ( NTS )
14:09:36 Copyright (c) 1997-2016 The PHP Group
14:09:36 Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
14:09:36     with Zend OPcache v7.0.13-dev, Copyright (c) 1999-2016, by Zend Technologies
14:09:36 HTTP/1.1 200 OK

(via @cilefen)

xjm’s picture

Mixologic’s picture

This is the first occurance of a php7 test failing with this issue : https://www.drupal.org/node/2808317#comment-11673203

And every single php7 patch from that point forward all have the exact same fails.

mradcliffe’s picture

There is an existing PHP bug at https://bugs.php.net/bug.php?id=71822.

Maybe we need to stay on the island and not use parse_url? Or maybe there's a scalable library out there already that could be included?

cilefen’s picture

This is reproducible on PHP 7.0 HEAD in isolation:

core ((8.2.0) %)$ php --version
PHP 7.0.13-dev (cli) (built: Oct  7 2016 16:06:36) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.11, Copyright (c) 1999-2016, by Zend Technologies
core ((8.2.0) %)$ ../vendor/bin/phpunit --filter=UrlConversionTest
PHPUnit 4.8.27 by Sebastian Bergmann and contributors.

EE..........

Time: 3.62 seconds, Memory: 126.00Mb

There were 2 errors:

1) Drupal\Tests\Core\Database\UrlConversionTest::testDbUrltoConnectionConversion with data set #0 ('', 'mysql://test_user:test_pass@t...tabase', array('mysql', 'test_user', 'test_pass', 'test_host', 'test_database', '3306'))
InvalidArgumentException: Minimum requirement: driver://host/database

/Users/cjm/Sites/drupal8x/core/lib/Drupal/Core/Database/Database.php:460
/Users/cjm/Sites/drupal8x/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php:21

2) Drupal\Tests\Core\Database\UrlConversionTest::testDbUrltoConnectionConversion with data set #1 ('/var/www/d8', 'sqlite://test_user:test_pass@...tabase', array('sqlite', 'test_user', 'test_pass', 'test_host', '/var/www/d8/test_database', 3306))
InvalidArgumentException: Minimum requirement: driver://host/database

/Users/cjm/Sites/drupal8x/core/lib/Drupal/Core/Database/Database.php:460
/Users/cjm/Sites/drupal8x/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php:21

FAILURES!
Tests: 12, Assertions: 10, Errors: 2.
Mixologic’s picture

cilefen++

cilefen’s picture

Status: Active » Needs review
StatusFileSize
new2.55 KB
new2.55 KB

The tests catch a legitimate PHP bug in HEAD. This is a moving-on-with-our-lives patch.

cilefen’s picture

How did I do that?

cilefen’s picture

StatusFileSize
new1.18 KB

This is one way to work around it. Better regex trickery is needed though.

mradcliffe’s picture

I think PathAliasTest may be affected too. Remember to add php 7 tests for the patch instead of 5.5.

Status: Needs review » Needs work

The last submitted patch, 11: 2813981-11.patch, failed testing.

alexpott’s picture

I'm not sure that we should be creating criticals against an un-released version of PHP. I think it is great we've had forewarning of this and we should be testing occasionally (nightly) against the bleeding edge but PHP7 patch and branch testing should be against the latest released version.

cilefen’s picture

StatusFileSize
new2.65 KB

Nevertheless, forget the workaround, but it seems sensible to test for all allowed credentials characters and null passwords. PathAliasTest has some more, probably better, characters. We could rescope this issue to just that.

@Mixologic How onerous would it be to switch to releases generally?

@alexpott: Because there will be fails, is this critical until CI is changed?

cilefen’s picture

Title: Drupal\Tests\Core\Database\UrlConversionTest failing on PHP 7 » Increase test coverage of allowed username/password characters in Drupal\Tests\Core\Database\UrlConversionTest
Component: routing system » database system
Issue summary: View changes
Priority: Critical » Normal
cilefen’s picture

Title: Increase test coverage of allowed username/password characters in Drupal\Tests\Core\Database\UrlConversionTest » [PP-1] Drupal\Tests\Core\Database\UrlConversionTest failing on PHP 7
Priority: Normal » Critical
Status: Needs work » Postponed

On further consideration and discussion with alexpott, this needs to remain critical and be postponed on #2814933: PHP 7 test runs should be on released versions. We are unlikely to implement our own parse_url(). We may like more test coverage but the existing test caught this one.

alexpott’s picture

Has this been fixed in PHP? It doesn't seem to be happening anymore?

cilefen’s picture

alexpott’s picture

Status: Postponed » Closed (cannot reproduce)

So we can close this one. The issue about which PHP7 version we test on is still relevant.