Ubuntu 10.04 and a number of other releases that I for one still commonly find in the wild have php 5.3.2. Seems that the only reason we bumped our required version to 5.3.5 was to follow Drupal 8 requirements:

Commit 14e9978f9: Bump minimum version of php required to 5.3.5 per #1751100: Bump minimum version of php required to 5.3.5

I'd like to pull Drush back to 5.3.2, and perhaps add a check for 5.3.5 when we are about to bootstrap Drupal. We could detect D8 via its filesystem layout, since we probably can't get its exact version until after we bootstrap. Any objections? If it seems okay, I'll put together a patch.

Comments

greg.1.anderson’s picture

StatusFileSize
new1.74 KB

Here is what I propose. If we had a strong need to require a later version of php due to a Drush requirement, then I think it would be fine to up the minimum php in Drush master. If this is just for D8, though, there are still a bunch of places where I run into php 5.3.2 pre-installed, sometimes on servers I don't directly control. I've upgraded some, but I'd rather take more time before making this a global requirement.

Here's the change log for php 5.3.5 (with 5.3.4 and 5.3.3 below).

http://us.php.net/ChangeLog-5.php#5.3.5

greg.1.anderson’s picture

Status: Active » Needs review
greg.1.anderson’s picture

Status: Needs review » Closed (works as designed)

Turns out that node_save can have problems with php < 5.3.5, so this isn't just a Drupal 8 issue. I'm going to take the @msonnabaum solution here. (Upgrade. Your. Shit.)

anarcat’s picture

Version: » 8.x-6.x-dev

wait what? node_save() has problems with PHP 5.3.5? in which drupal version? and if so why weren't the requirements updated? reminder: Drupal 7 depends on PHP 5.2.5 or later.

https://drupal.org/requirements/php

The above page also mentions that Drupal 6 contrib modules are mostly unusable with PHP 5.4 (which I can confirm, at least views is really annoying), and I suspect Drupal 7 has its own issues with it. Often PHP 5.4 is the solution to fix this drush dependency: it's the only upgrade path available in Debian for example. It's also the version available in Fedora...

So what, exactly, makes Drush incompatible with PHP 5.3.3? and why the heck do we force a version comparison instead of letting stuff break? a warning could be sufficient...

anarcat’s picture

Status: Closed (works as designed) » Needs review
StatusFileSize
new1.31 KB

and here's a patch for ya.

greg.1.anderson’s picture

Status: Needs review » Needs work

#5 completely removes the floor for php versions. I could see perhaps allowing "slightly older" versions of php to work, but it seems to me that there should always be some minimum version at which we bail out and do not run. Nothing below 5.2.4, for example. Before we lower the absolute floor, though, we should investigate how the unit tests do with older versions of php.

I regret that I did not put a link in to the source that described the problems that can happen with node_save and php < 5.3.5; I read this a long time ago, I am no longer prepared to speculate why the release notes were not updated. Regarding the upgrade path, the page you quote has a recommendation for getting to 5.3.10 on Debian.

greg.1.anderson’s picture

There is a proposal to use closures in #2008928: Make config edit filter instead of bailing out when item does not exists.. If we are going to roll back to 5.2.x as a minimum version, we should do so before that issue is decided. (Early indications are "no closures", though.)

Beyond that, I do not know if there is anything in Drush that was unconsciously added to Drush that requires 5.3.x. A lot of time has gone by since last November; I'm surprised that no one but me has has any issue with lack of 5.2 support since then. Since so much time has gone by, my concern is that there may be a number of failures on 5.2 by now. Since we're so close to the Drush 6 release, I think we may be stuck with 5.3 and later now. If php 5.2 users really are in the minority, they could stick with Drush 5.

moshe weitzman’s picture

If the test suite passes, I'm OK with drush6 moving back to 5.2.

jonhattan’s picture

If we're moving back to 5.2, some changes in 8dca558da0fd2eb91552d3fb554365840e48b4af must be reverted. Also 31b9bb0ba6c0f10d36fdd2baa82a6f29e9360dde

In general git log -S"5.3" should be reviewed.

ergonlogic’s picture

I believe that the point in #4 was to continue support Drupal 6 and Debian Squeeze. Even if 5.2 seems like a bit of a stretch, it seems clear that we could lower the requirement at least that far (5.3.3), no?

Also, the original issue suggested:

add a check for 5.3.5 when we are about to bootstrap Drupal. We could detect D8 via its filesystem layout, since we probably can't get its exact version until after we bootstrap.

I certainly like the idea of de-coupling Drush's required PHP version from Drupal's. Would this imply that we'd move the Drupal version-specific check into _drush_bootstrap_drupal_root()? In that case, perhaps drush_drupal_major_version() shouldn't depend on bootstrapping Drupal at all, but should rather just check for the existence of core/includes/bootstrap.inc (et. al.).

jonhattan’s picture

What's the point with 5.3.3, Drupal 6 and Squeeze? dotdeb.org provides php 5.3.26 for squeeze.

btw, drush_drupal_major_version() only needs the path to drupal root. No further bootstrap.

anarcat’s picture

Some people (including me and many others) do not run Dotdeb packages. They compile PHP differently and the upgrade path to and from dotdeb is not exactly trivial.

The point of D6, PHP 5.3.3 and squeeze is that this is what squeeze is. It's a stable and controled environment that will only feature security fixes. Who knows what went into dotdeb's version of 5.3.26?

Using your logic, we might as well say that people can easily compile PHP themselves and could run PHP 6.x on Debian potato without problems. Heck, we should just rewrite Drush in Ruby while we're here, that would make for fun version dependencies.

I find it amazing that we go through all those crazy hoops to support Windows but we can't support Debian properly or Ubuntu LTS 10.04.

As for the check itself: i am not proposing to remove the check, I am proposing to make it a warning. If drush will fail with older PHP versions, why don't we let if fail? How do we know it will really fail? Maybe some people did some hackery to work around their issues in their PHP compilation (it could very well be the case for squeeze's 5.3.3).

This reminds me of problems with checking if we have write access before writing - you should just try to write and rollback properly. See also http://en.wikipedia.org/wiki/Time_of_check_to_time_of_use

greg.1.anderson’s picture

I'm still not in favor of removing the check. We should only allow supported configurations to run. Per #9, we know that 5.2 will fail, so we're not going to let it run.

Issues with the way Drush detects and reports error conditions (e.g. unwritable files) should be raised in a separate issu.

I think it would be quick and safe to roll the check back to PHP 5.3.3. If anyone wants to go back further, then we need to re-apply the necessary PHP 5.2 workarounds identified in #9. Per #8, it's okay to go back to a prior version if someone wants to do the work to test it and make sure it works. If no one wants to do the work, then we'll stick with what's already committed.

anarcat’s picture

8dca558da0fd2eb91552d3fb554365840e48b4af requires 5.2.1, so that's okay.

31b9bb0ba6c0f10d36fdd2baa82a6f29e9360dde is less clear - it says there's inconsistencies in mime type detection in 5.2, but doesn't say which version exactly.

the run-server stuff needs 5.3, but that's okay. i looked at git log -S 5.3 until 2 years back and that's all i found.

so i really think that requiring a higher 5.3 version is premature. 5.3.0 should work for everything that was mentionned here, and some 5.2 release may just work for most of drush.

it would be a damn shame if drush would just lock people away because they are running an older PHP version. at least allow them to *start* drush and they get *something*, even if with reduced functionality. worse case, a kill switch for lower PHP versions should be opt-out with an option, say --yes-i-know-i-am-an-old-fart that would override the version check...

otherwise we are just leaving people out.

i hate it when i need to throw away perfectly working devices after 5 years. software should be the same, and we should strive to avoid obsolescence, not encourage it.

greg.1.anderson’s picture

Okay; roll a patch and run the test suite against it on a system with an appropriately old php version on it, and we can put it in. If we go back to 5.2, runserver could explicitly check for 5.3.

greg.1.anderson’s picture

FYI, just saw this via Twitter: http://news.php.net/php.internals/67734. The first 5.3 release was in 2009. The last 5.2 release was in 2011. All php releases are here: http://php.net/releases/index.php

I know, this does not invalidate the comments about old php releases; there is just something ironic about the fact that 5.3 is now EOL, and we are still discussing whether or not it should be required. If we're going to go back to 5.2, someone should submit a patch before Drush 6 is released.

ergonlogic’s picture

Status: Needs work » Needs review
StatusFileSize
new2.56 KB

I tested the latest HEAD (d543b36faf6) against PHP 5.3.3, and while there were 2 errors, I don't believe either were related to this:

There were 2 failures:

1) drushScriptCase::testPhpOptionsTest
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'text/drush'
+'text/html'

/usr/share/drush/tests/drushScriptTest.php:25

2) quickDrupalCase::testQuickDrupal
Unexpected exit code: /usr/bin/drush --root=/tmp/drush-sandbox/qd-devel --nocolor core-quick-drupal --yes --no-server --makefile=/usr/share/drush/tests/makefiles/qd-devel.make
Failed asserting that 1 matches expected 0.

/usr/share/drush/tests/drush_testcase.inc:349
/usr/share/drush/tests/drush_testcase.inc:416
/usr/share/drush/tests/quickDrupalTest.php:42
/usr/share/drush/tests/quickDrupalTest.php:53

FAILURES!
Tests: 109, Assertions: 1000, Failures: 2, Skipped: 6.

I've attached a patch that reduces the minimum PHP version to 5.3.3, as well as introducing a new global option, "--no-min-php-error", to allow the error to be ignored.

greg.1.anderson’s picture

Status: Needs review » Needs work

I guess that --no-min-php-error is acceptable in concept, although I don't know how useful the proposed implementation is, since it cannot be placed in a drushrc.php file. Folks would try to do it, and we'd get support and feature requests. I don't think we should create a confusing situation like this.

I think that a better strategy is:

1. Roll back the 5.2-support code identified in #9.

2. Make the absolute minimum php 5.2.x (x up for discussion; 0 or 4 or something)

3. In _drush_bootstrap_drupal_root, check for php 5.3.x for Drupal 8+. (Edit: Per #15, runserver should also explicitly test for php 5.3)

I don't think we should allow php below 5.2.0 in any event, even with a flag. We could introduce a flag at step 3 to subvert the version check, but at that point it wouldn't be of too much help to do so, so I'm indifferent about including it or leaving it out.

In absence of doing that much work, I think that going back to 5.3.3 w/out the --no-min-php-error. Regarding the failures in #17, the qd test commonly fails on some systems (not sure why, but perhaps no sqlite available?), but it works in general, so I think this one can be ignored. The testPhpOptionsTest bears further investigation before reverting to 5.3.3; I'm not sure this is innocuous.

ergonlogic’s picture

Re. testPhpOptionsTest, I had /usr/bin/drush linked directly to drush.php, and so was bypassing the shell script. That test passes now.

fwiw, I'd be fine with just rolling back to 5.3.3, as I don't have a 5.2 environment to test the rollbacks mentioned in #9.

As for an '--no-min-php-error' option, it's just a nice-to-have, imo. We could avoid documenting it in the help output by doing something like:

  if ($key = array_search('--no-min-php-error', $GLOBALS['argv'])) {
    unset($GLOBALS['argv'][$key]);
  }
  if (version_compare(phpversion(), DRUSH_MINIMUM_PHP) < 0 && $key === FALSE) {
    return drush_set_error('DRUSH_REQUIREMENTS_ERROR', dt('Your command line PHP installation is too old. Drush requires at least PHP !version.', array('!version' => DRUSH_MINIMUM_PHP)));
  }
greg.1.anderson’s picture

I'd be happy with just rolling back to 5.3.3 now, and leaving 5.2.x for a potential later improvement, if others agree.

I don't think there's much value to providing a cli-only option to skip the minimum php version. Maybe an environment variable would work better, as that would be something that you could set in your bashrc and forget. I don't think we should allow earlier than 5.2.0, though, even with an environment variable set.

ergonlogic’s picture

Status: Needs work » Needs review
StatusFileSize
new1.28 KB

Here's a patch that lowers the minimum PHP to 5.3.3 and skips the error in an environment variable (DRUSH_NO_MIN_PHP) is set.

I don't think we should allow earlier than 5.2.0, though, even with an environment variable set.

It seems to me that if someone sets this env var, they'd have to be aware that they are taking their chances, and we should probably let them.

moshe weitzman’s picture

Status: Needs review » Fixed

Committed. Thanks for sticking with this.

moshe weitzman’s picture

If anyone has an idea about where to document the new Env Variable, let us know or write a docs patch. Thanks.

anarcat’s picture

thanks!

ergonlogic’s picture

Status: Fixed » Needs review
StatusFileSize
new934 bytes

How about documenting it in examples/example.bashrc?

helmo’s picture

#25 looks good.

moshe weitzman’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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