diff --git a/include/tests_php b/include/tests_php index 8345712f..8a7db951 100644 --- a/include/tests_php +++ b/include/tests_php @@ -128,17 +128,21 @@ # Description : Check php register_globals option # Notes : Don't test for it if PHP version is 5.4.0 or later (it has been removed) if [ ! "${PHPINIFILE}" = "" -a ! "${PHPVERSION}" = "" -a ! "${EGREPBINARY}" = "" ]; then - FIND=`echo ${PHPVERSION} | ${EGREPBINARY} "^(4.|5.[0-3])"` - if [ "${FIND}" = "" ]; then - PREQS_MET="NO"; Debug "Found most likely PHP version 5.4.0 or higher (${PHPVERSION}) which does not use register_globals" - else - PREQS_MET="YES"; Debug "Found PHP version 4 or up to 5.3 (${FIND}) which we are going to scan" + if [ -f "${PHPINIFILE}" ]; then + FIND=`echo ${PHPVERSION} | ${EGREPBINARY} "^(4.|5.[0-3])"` + if [ "${FIND}" = "" ]; then + PREQS_MET="NO"; Debug "Found most likely PHP version 5.4.0 or higher (${PHPVERSION}) which does not use register_globals" + else + PREQS_MET="YES"; Debug "Found PHP version 4 or up to 5.3 (${FIND}) which we are going to scan" + fi + else + Debug "File php.ini (${PHPINIFILE}) not found" fi - else - PREQS_MET="NO" - Debug "Skipping test: php.ini not found, or PHP version empty" - Debug "php.ini: ${PHPINIFILE}" - Debug "version: ${PHPVERSION}" + else + PREQS_MET="NO" + Debug "Skipping test: php.ini not found, or PHP version empty" + Debug "php.ini: ${PHPINIFILE}" + Debug "version: ${PHPVERSION}" fi Register --test-no PHP-2368 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check PHP register_globals option" if [ ${SKIPTEST} -eq 0 ]; then