Skip to content

修复了PHP8兼容,警告消除以及导入逻辑的修正#1129

Merged
zhblue merged 3 commits intozhblue:masterfrom
jepeng-miao:master
Jan 24, 2026
Merged

修复了PHP8兼容,警告消除以及导入逻辑的修正#1129
zhblue merged 3 commits intozhblue:masterfrom
jepeng-miao:master

Conversation

@jepeng-miao
Copy link
Copy Markdown
Contributor

消除导入的警告,以及修复导入批量会把前一题替换的逻辑

Fix deprecated zip functions and undefined variable warnings in problem import

Details:
- Replace deprecated `zip_open()`, `zip_read()`, `zip_entry_*` functions with `ZipArchive` class in `problem_import_syzoj.php` and `problem_import_hoj.php`.
- Fix "Undefined variable $spjlang" warning in `problem_import_xml.php` by adding `isset()` check.
- Remove usage of undefined `$path` variable in import scripts.
Fix: Resolve PHP 8 deprecations, undefined warnings, and import logic bugs

1. Fix Problem Import Logic (problem_import_xml.php):
   - Fix "Undefined variable $spjlang" warning.
   - Fix bug where empty `remote_oj` tags in XML caused existing problems to be overwritten instead of creating new ones.
   - Add `unset($spjlang)` and `unset($tpjlang)` in batch import loop to prevent SPJ attributes from leaking to subsequent problems.
   - Replace deprecated `zip_open`/`zip_read` functions with `ZipArchive` class.

2. Fix Zip Import Handlers (problem_import_syzoj.php, problem_import_hoj.php):
   - Replace deprecated `zip_*` functions with `ZipArchive` for PHP 8 compatibility.
   - Remove redundant double-loop processing in HOJ import.
   - Add directory existence checks.

3. Fix Admin Warnings (problem_df_change.php, contest_add.php, news_add_page.php):
   - Add `isset($_POST['hlist'])` checks to resolve "Undefined array key" and "trim(): Passing null" warnings.
@zhblue zhblue merged commit 8fdeaec into zhblue:master Jan 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants