Something like

$php_ver = substr(phpversion(),0,strpos(phpversion(), '-'));
if (($php_ver) > "5.2") || ($php_ver) < "5.2")) {
   drupal_set_message(t('Your version of php:@ver is incompatable with date api which only works on version 5.2 of php', array('@version' $php_version) );
}
install..

see: http://us.php.net/manual/en/function.phpversion.php

It would help make me at least not scratch my head so much and think about submitting an issue. And you can do >< or != it would be better, that just allows for more finite control.

Comments

arlinsandbulte’s picture

Drupal 7 core requires PHP 5.2, so what exactly is the purpose of this?
http://drupal.org/requirements

ransom’s picture

5.3 will not work either.

arlinsandbulte’s picture

In that case, I think you should file an issue. There is ongoing work to make Date PHP 5.3 compatible:
http://drupal.org/project/issues/date?text=PHP+5.3&status=Open&prioritie...

arlinsandbulte’s picture

Status: Active » Closed (won't fix)

Also, PHP version could be specified in the .info file instead: http://drupal.org/node/542202

BUT,

Doing so would prevent any PHP 5.3 development. That should not happen.
So, I am marking this as "won't fix"

ransom’s picture

Firstly I'm not pushing to make work stop on 5.3 I'd hoped it was and spent a some time wondering why it was not.

It's on the page, and the readme, so it's documented.

This also would not stop it from working or being worked on in 5.3:

drupal_set_message(t('Your version of php:@ver is incompatable with date api which only works on version 5.2 of php', array('@ver' $php_version), "error" );

or

drupal_set_message(t('Your version of php:@ver is incompatable with date api which only works on version 5.2 of php', array('@ver' $php_version), "warn");

see: http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/drupal...

Both would just let the user know that it may not work and why, not everyone reads readme's (even if they should). The second one just allows pass through, the first would halt. A 1 line addition (if you brake code standards). For those also that host remotely and are rebuilding there local copy it would let them know why it's not working where there local copy did. I suggested installed however maybe the configuration forum would be better for that as it's constantly checked when viewed, that would allow those that are drush synced or ftp synced to know there is a problem, and why.

I don't want a big debate about it, if it's worthy of a patch someone can post one or let it go since 5.3 is in the works. It was just an idea, not a bug.

I'm surprised there's no Drupal system variable for php version for module dependence to check, perhaps I'm wrong though.

karens’s picture

Status: Closed (won't fix) » Active

This message is for the D6 version. It is a mistake for it to be in the D7 version. I need to remove it.

ransom’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev

version

karens’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev

Don't change the versions on issues. This is a D7 issue.

karens’s picture

Status: Active » Closed (won't fix)

I mis-read this issue. You are not saying there is a warning about the PHP version, you are saying you don't think version 5.3 works. As far as I know version 5.3 works in Drupal 7 and probably in Drupal 6. I am not making any attempt to support 5.3 in the Drupal 5 version.

So if I am now reading this right, there is no need for this message.