Un tour sur le contrôle de la vesion PH P dans la 3.2-dev

James <[email protected]>
Newsgroups gmane.comp.web.spip.devel
Message-ID <CAE50Zk5k1EePKiixCRna0BcP+2W6g7QKBe7RgWpmK=bGasNWaQ@mail.gmail.com>
Coucou,

j'ai fait quelques `grep` pour voir où SPIP en était dans ses contôles de
version PHP.

1/ recherche des appels à phpversion()

grep -rin phpversion *

ecrire/inc/cookie.php:60:       ($httponly and strnatcmp(phpversion(),
'5.2.0') >= 0) ?
ecrire/inc/filtres.php:4727:            if (substr(phpversion(), 0, 5) ==
'5.4.0' and !@gzinflate($env)) {
ecrire/inc/filtres_ecrire.php:454:  if (version_compare(phpversion(),
_PHP_MIN) == -1) {
ecrire/inc/filtres_ecrire.php:456:          array('min' => _PHP_MIN,
'version' => phpversion()));
ecrire/inc/install.php:169: $p = phpversion();
ecrire/inc/session.php:631:     if (version_compare(phpversion(), '5.4.0',
'>=')) {
ecrire/plugins/get_infos.php:128:       $ret['procure']['php'] =
array('nom' => 'php', 'version' => phpversion());
plugins-dist/safehtml/lib/safehtml/classes/HTMLSax3/Decorators.php:75:if
(version_compare(phpversion(), '4.3', '<') &&
!function_exists('html_entity_decode') ) {
plugins-dist/safehtml/lib/safehtml/classes/HTMLSax3.php:223:  if
(version_compare(phpversion(), '4.3', 'ge')) {

Selon moi, le test dans inc/cookie peut être supprimé.
dans inc/filtres_ecrire, je ne vois pas bien à quoi ça sert.
dans le plugin safehtml, il me semble qu'il faut plutôt chercher une
alternative à cette lib.

c'est surtout dans inc/install que le boutot devrait se faire (la version
minimum y est toujours 5.1.0 d'ailleurs...

2/ recherche de l'utilisation de _PHP_MIN :

grep -rn _PHP_MIN *

ecrire/inc/filtres_ecrire.php:454:  if (version_compare(phpversion(),
_PHP_MIN) == -1) {
ecrire/inc/filtres_ecrire.php:456:          array('min' => _PHP_MIN,
'version' => phpversion()));
ecrire/inc_version.php:36:define('_PHP_MIN', '5.3.0');

idem pour inc/filtres-ecrire
ecrire/inc_version.php, OK.

3/ recherche de PHP_VERSION_ID :

grep -rn PHP_VERSION_ID *

ecrire/inc/flock.php:460:   if (!defined('PHP_VERSION_ID') ||
PHP_VERSION_ID < 50300) {
ecrire/inc/utils.php:2298:  // PHP_VERSION_ID dispo depuis PHP 5.2.7
ecrire/inc/utils.php:2299:  if (!defined('PHP_VERSION_ID')) {
ecrire/inc/utils.php:2301:     define('PHP_VERSION_ID', ($version[0] *
10000 + $version[1] * 100 + $version[2]));
ecrire/inc/utils.php:2331:  if (PHP_VERSION_ID<50300) {

les 2 tests dans in/utils ne sont plus nécessaires
dans inc/flock, c'est la fonction spip_clearstatcache qui n'est plus utile
et qui pourrait être remplacée  par la fonction native partout :

3bis/
grep -rn spip_clearstatcache *

ecrire/inc/filtres.php:5758:            spip_clearstatcache(true,
$filename); // eviter que PHP ne reserve le vieux timestamp
ecrire/inc/flock.php:459:function spip_clearstatcache($clear_realpath_cache
= false, $filename = null) {
ecrire/inc/flock.php:474:   spip_clearstatcache(true, $filepath);
plugins-dist/compresseur/inc/compresseur_concatener.php:139:
spip_clearstatcache(true, $nom_tmp);
plugins-dist/compresseur/inc/compresseur_concatener.php:151:
spip_clearstatcache(true, $nom);
plugins-dist/compresseur/inc/compresseur_minifier.php:300:
spip_clearstatcache(true, $file);

4/ enfin, recherche de PHP_VERSION_ID :
grep -rn PHP_VERSION_ID *

ecrire/inc/flock.php:460:   if (!defined('PHP_VERSION_ID') ||
PHP_VERSION_ID < 50300) {
ecrire/inc/utils.php:2298:  // PHP_VERSION_ID dispo depuis PHP 5.2.7
ecrire/inc/utils.php:2299:  if (!defined('PHP_VERSION_ID')) {
ecrire/inc/utils.php:2301:     define('PHP_VERSION_ID', ($version[0] *
10000 + $version[1] * 100 + $version[2]));
ecrire/inc/utils.php:2331:  if (PHP_VERSION_ID<50300) {

idem que 3/

J'ai un patch tout prêt pour le core. Reste à savoir si le plugin
compresseur (qui utilise spip_clearstatcache() supporterai l'appel natif
dans une version antérieure à 3.2-dev


Des avis ?

Bisou,
-- 
James
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.