diff --git a/lib/php-analyzer.sh b/lib/php-analyzer.sh index 2992a6a..3cd2aaf 100644 --- a/lib/php-analyzer.sh +++ b/lib/php-analyzer.sh @@ -432,7 +432,7 @@ detect_php_config_issues() { post_bytes=$(convert_to_bytes "$post_max") # ISSUE 1: post_max_size < upload_max_filesize - if [ "$post_bytes" -lt "$upload_bytes" ]; then + if [ -n "$post_bytes" ] && [ -n "$upload_bytes" ] && [ "$post_bytes" -lt "$upload_bytes" ]; then issues+="CONFIG_MISMATCH|CRITICAL|post_max_size ($post_max) < upload_max_filesize ($upload_max)|Set post_max_size >= upload_max_filesize"$'\n' fi @@ -444,7 +444,7 @@ detect_php_config_issues() { # ISSUE 3: memory_limit too low local memory_bytes memory_bytes=$(convert_to_bytes "$memory_limit") - if [ "$memory_bytes" -lt $((128 * 1024 * 1024)) ]; then + if [ -n "$memory_bytes" ] && [ "$memory_bytes" -lt $((128 * 1024 * 1024)) ]; then issues+="PERFORMANCE|MEDIUM|memory_limit is very low ($memory_limit)|Consider increasing to at least 128M"$'\n' fi @@ -454,7 +454,7 @@ detect_php_config_issues() { local error_count error_count=$(echo "$max_children_errors" | grep "TOTAL" | cut -d'|' -f1) - if [ "$error_count" -gt 0 ]; then + if [ -n "$error_count" ] && [ "$error_count" -gt 0 ]; then issues+="CAPACITY|CRITICAL|pm.max_children limit reached $error_count times in last 7 days|Increase pm.max_children setting"$'\n' fi