Fix SCRIPT_DIR variable collision in PHP libraries
CRITICAL BUG FIX: Problem: php-detector.sh and php-analyzer.sh were setting SCRIPT_DIR which collided with parent script's SCRIPT_DIR variable causing /lib/lib/ double path bug when sourcing libraries. Solution: - Changed SCRIPT_DIR to _LIB_DIR in both php-detector.sh and php-analyzer.sh - Changed exit 1 to return 1 in sourced libraries (exit kills parent script) Files modified: - lib/php-detector.sh: Use _LIB_DIR instead of SCRIPT_DIR - lib/php-analyzer.sh: Use _LIB_DIR instead of SCRIPT_DIR, return instead of exit This prevents variable collision when libraries are sourced by modules.
This commit is contained in:
+3
-3
@@ -4,9 +4,9 @@
|
||||
# Dependencies: lib/php-detector.sh, lib/system-detect.sh
|
||||
|
||||
# Source required libraries
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/php-detector.sh" 2>/dev/null || { echo "ERROR: php-detector.sh not found"; exit 1; }
|
||||
source "$SCRIPT_DIR/system-detect.sh" 2>/dev/null || { echo "ERROR: system-detect.sh not found"; exit 1; }
|
||||
_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$_LIB_DIR/php-detector.sh" 2>/dev/null || { echo "ERROR: php-detector.sh not found"; return 1; }
|
||||
source "$_LIB_DIR/system-detect.sh" 2>/dev/null || { echo "ERROR: system-detect.sh not found"; return 1; }
|
||||
|
||||
# ============================================================================
|
||||
# ERROR LOG ANALYSIS
|
||||
|
||||
Reference in New Issue
Block a user