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
This commit is contained in:
+3
-3
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user