[TYPO3-core] phpversion() vs PHP_VERSION

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Tue Jun 6 15:14:39 CEST 2006


Michael Stucki schrieb:
> Hi Martin,
> 
> I didn't know about version_compare() yet and was just working on a
> replacement of the int_from_ver() function.
> 
> Seems like it makes more sense to mark int_from_ver() as deprecated and use
> version_compare() for testing version requirements instead.

 > There is just one problem:
> 
> echo version_compare('4.1rc4', '4.1beta3', 'le') ? 'yes' : 'no';
> 
> Why does this return "yes"?

I tested a few strings and found the function to be case sensitive.

You have to stick to these strings (whatever "pl" may be):

dev < alpha = a < beta = b < RC < pl

So the only thing is, we must use this capitalization.

But I don't recommend testing of alpha, etc for public production 
extensions. int_from_ver() should be good enough for most cases, but it 
won't hurt to be version_compare() compatible.

For simpler checks we could also introduce TYPO3_version_major and 
TYPO3_version_minor (currently "4" and "0")

Masi



More information about the TYPO3-team-core mailing list