Repository navigation
chore: upgrade PHP from 7.2 to 8.4.27 - #685
Merged
Merged
Conversation
Makes Model_Uri __sleep and __wakeup public: PHP 8 warns about private magic methods and prints the warning into the first page after FPM start.
PHP 8.4.27 fixes CVE-2026-109618 and CVE-2026-109619 (RCE in PHP-FPM), PHP 7.2 does not get security fixes. - use Debian Bookworm image: it ships ImageMagick 6 where Imagick::setImageOpacity() used by social covers still exists - install memcache 8.2, imagick 3.8.1 and redis 6.3.0 from PECL - use new GD configure flags - build fontconfig cache to avoid errors in FPM logs
- codex-team/hawk.php 2.1.4 requires PHP ^7.1, update to 2.3.0 - phpunit 3.7 can not be installed or run on PHP 8, the only test is a sample
- Arr::path() passed Config_Group to array_key_exists(), which throws TypeError since PHP 8.0 and broke every POST request via XSS filter - replace each() removed in PHP 8.0 in Response::cookie() - drop imagerotate() ignore_transparent argument removed in PHP 8.3
Kohana converts every reported error into an exception, and Kohana 3.3 raises a lot of deprecations on PHP 8, so production returned 500 on every page. E_STRICT constant is deprecated in PHP 8.4.
There was a problem hiding this comment.
🟡 Changes recommended
GD’s resource-only loading guard discards image transformations when saving or rendering under PHP 8.
1 open issue
What changed in this PR
Migrates the site from PHP 7.2 to PHP 8.4.27, updating dependencies and legacy Kohana code for compatibility.
Changes:
- Updates the Docker runtime, extensions, and font cache.
- Upgrades Hawk and removes obsolete PHPUnit dependencies.
- Adjusts Kohana APIs and production error reporting for PHP 8.
| File | Description |
|---|---|
| www/system/classes/Kohana/Response.php | Replaces removed each() with foreach. |
| www/system/classes/Kohana/Arr.php | Handles ArrayAccess objects in path lookup. |
| www/public/build/release.json | Updates the release timestamp. |
| www/modules/image/classes/Kohana/Image/GD.php | Removes the obsolete rotation argument. |
| www/composer.lock | Records updated dependencies and removals. |
| www/composer.json | Removes PHPUnit 3.7. |
| www/application/bootstrap.php | Suppresses production deprecation warnings. |
| docker/php/Dockerfile | Upgrades PHP and extensions; builds font cache. |
Review effort: Balanced
Since PHP 8.0 GD returns GdImage objects instead of resources, so _load_image() treated a loaded image as not loaded and reloaded the original file on save() and render(), losing rotate, resize and crop.
gohabereg
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

21 октября вышло security advisory PHP: две критические RCE-уязвимости (CVE-2026-109618, CVE-2026-109619, CVSS 9.2) затрагивают PHP-FPM. Исправления выпущены только для 8.2–8.5, а PHP 7.2 давно не получает обновлений. Поэтому переводим сайт с
php:7.2-fpmнаphp:8.4.27-fpm-bookworm.Что изменилось
Docker (
docker/php/Dockerfile)php:8.4.27-fpm-bookworm. Bookworm выбран из-за ImageMagick 6: в ImageMagick 7 нетImagick::setImageOpacity(), а он нужен генератору обложек.fc-cache -fпри сборке, иначе FPM пишетFontconfig error: No writable cache directoriesна каждую генерацию обложки.Зависимости (
www/composer.json,www/composer.lock)codex-team/hawk.php2.1.4 → 2.3.0: старая версия требует PHP ^7.1.phpunit/phpunit3.7: на PHP 8 он не ставится и не запускается, а единственный тест в проекте —SampleTest(1+1).Совместимость Kohana с PHP 8
Arr::path()передавал объектConfig_Groupвarray_key_exists(). На PHP 8 это TypeError, из-за которого падал любой POST-запрос через XSS-фильтр, в том числе форма на/lab.Response::cookie():each()удалён в PHP 8.0.Image_GD::_do_rotate(): аргументignore_transparentуimagerotate()удалён в PHP 8.3.__sleep/__wakeupвModel_Uriдавали предупреждение, которое после каждого старта FPM печаталось в начало страницы.Прод (
www/application/bootstrap.php)error_reportingвключалE_DEPRECATED. Kohana превращает любую ошибку в исключение, а Kohana 3.3 на PHP 8 выдаёт много deprecation-предупреждений, поэтому без этой правки весь прод отдаёт 500. Теперь deprecation-предупреждения на проде выключены. Убрана и константаE_STRICT: в PHP 8.4 она deprecated.Как проверено
Локально на
php:8.4.27-fpm-bookworm, в режимахDEVELOPMENTиPRODUCTION:/articles,/lab,/join,/contests,/bot,/sitemap.xmlотдают 200, новых ошибок в логах Kohana нет;/labработает анонимно и под пользователем: заявка сохраняется, эмодзи заменяются, уведомление в бот уходит;auth_tokenработают;/articlesи на главной;/cover/...генерируются через Imagick.Загрузку картинок в S3 локально проверить не удалось, нет ключей AWS. AWS SDK на PHP 8.4 доходит до отправки запроса без ошибок.
Что учесть
pecl.php.netчасто отвечает 500, поэтому сборка образа может падать наpecl install. Если так, просто перезапустите сборку.composer auditнаходит 18 уязвимостей в aws-sdk-php, guzzle, psr7 и jmespath. Это не связано с переходом на PHP 8.4, обновление будет отдельным PR.