View Issue Details

IDProjectCategoryView StatusLast Update
0032714mantisbtcode cleanuppublic2023-10-31 16:32
Reporteratrol Assigned Toatrol  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Target Version2.26.0Fixed in Version2.26.0 
Summary0032714: Remove function check_php_version()
Description

function check_php_version is questionable in some terms

  • check for $p_version == PHP_MIN_VERSION will hardly ever evaluate to
    true in real life (who is running exactly PHP 7.0.0?)
  • parameter $p_version is not used in else case,
    this was hardly what was wanted, but did not introduce any bug,
    as phpversion() is used instead of the parameter
  • check function_exists( 'version_compare' ) is not necessary as
    • according documentation, version_compare() is available starting
      from PHP 4.1 [1]
    • we use version_compare() at various other places in code without
      checking if it exists

Thus

  • remove the function
  • replace the single place where it's called by using version_compare()

[1] https://www.php.net/manual/de/function.version-compare.php

TagsNo tags attached.

Activities

Related Changesets

MantisBT: master 4b638dde

2023-06-10 10:51

atrol


Details Diff
Remove function check_php_version

function check_php_version is questionable in some terms
- check for $p_version == PHP_MIN_VERSION will hardly ever evaluate to
true in real life (who is running exactly PHP 7.0.0?)
- parameter $p_version is not used in else case,
this was hardly what was wanted, but did not introduce any bug,
as phpversion() is used instead of the parameter
- check function_exists( 'version_compare' ) is not necessary as
- according documentation, version_compare() is available starting
from PHP 4.1 [1]
- we use version_compare() at various other places in code without
checking if it exists

Thus
- remove the function
- replace the single place where it's called by using version_compare()

Fixes 0032714

[1] https://www.php.net/manual/de/function.version-compare.php
Affected Issues
0032714
mod - admin/install.php Diff File
mod - core/install_helper_functions_api.php Diff File

MantisBT: master 024ead1a

2023-06-10 17:01

atrol


Details Diff
Remove unreachable code

Minimum PHP version is checked in an early state in core.php and
treated as a FATAL error calling die(), so this code can never be
reached

Issue 0032714
Affected Issues
0032714
mod - admin/check/check_php_inc.php Diff File
mod - admin/install.php Diff File