| Server IP : 119.195.102.159 / Your IP : 216.73.217.134 Web Server : nginx/1.18.0 System : Linux picell 5.15.0-181-generic #191-Ubuntu SMP Fri May 22 19:09:02 UTC 2026 x86_64 User : altablue ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /tmp/ |
Upload File : |
import os, re
board_dirs = ['/home2/haeyulhome/board', '/home2/haeyulhome/ko_admin/board']
issues_found = []
files_fixed = 0
# Patterns for potential PHP 8.3 fatal errors
pattern_end = re.compile(r'end\s*\(\s*(\$[a-zA-Z0-9_]+)\s*\)')
pattern_reset = re.compile(r'reset\s*\(\s*(\$[a-zA-Z0-9_]+)\s*\)')
pattern_current = re.compile(r'current\s*\(\s*(\$[a-zA-Z0-9_]+)\s*\)')
pattern_key = re.compile(r'key\s*\(\s*(\$[a-zA-Z0-9_]+)\s*\)')
pattern_curly = re.compile(r'(\$[a-zA-Z0-9_]+)\{([a-zA-Z0-9_\$]+)\}')
pattern_each = re.compile(r'each\s*\(\s*(\$[a-zA-Z0-9_]+)\s*\)')
for bdir in board_dirs:
if not os.path.exists(bdir): continue
for root, dirs, files in os.walk(bdir):
for file in files:
if file.endswith(('.php', '.html', '.htm')):
path = os.path.join(root, file)
try:
with open(path, 'r', encoding='utf-8', errors='ignore') as f:
content = f.read()
orig = content
# 1. end($var)
if 'end(' in content:
content = pattern_end.sub(r'(is_array() ? end() : "")', content)
# 2. reset($var)
if 'reset(' in content:
content = pattern_reset.sub(r'(is_array() ? reset() : "")', content)
# 3. current($var)
if 'current(' in content:
content = pattern_current.sub(r'(is_array() ? current() : "")', content)
# 4. key($var)
if 'key(' in content:
content = pattern_key.sub(r'(is_array() ? key() : "")', content)
# 5. $var{idx}
if '{' in content and '$' in content:
content = pattern_curly.sub(r'[]', content)
if content != orig:
with open(path, 'w', encoding='utf-8') as f:
f.write(content)
files_fixed += 1
issues_found.append(path)
except Exception as e:
print(f"Error checking {path}: {e}")
print(f"=== Board Proactive Check Results ===")
print(f"Fixed {files_fixed} files with potential PHP 8.3 array/type errors.")
for p in issues_found:
print(f" - Fixed: {p}")