From 84081a93b7938b7347fe5be03b9914daebe3aa61 Mon Sep 17 00:00:00 2001 From: cschantz Date: Wed, 3 Dec 2025 01:16:33 -0500 Subject: [PATCH] Fix integer expression errors in php-analyzer.sh Problem: - Lines 435, 447, 457: integer expression expected errors - convert_to_bytes() returns empty string when input is empty - Bash arithmetic fails on empty strings: [ "" -lt 128 ] Fix: - Added empty checks before all numeric comparisons - Pattern: [ -n "$var" ] && [ "$var" -lt value ] - Applied to lines 435, 447, 457 Lines fixed: - 435: post_bytes vs upload_bytes comparison - 447: memory_bytes vs 128MB comparison - 457: error_count > 0 comparison Result: - No more integer expression errors - Script completes domain analysis successfully --- lib/php-analyzer.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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