「Php/fuelphp/バージョンアップ」の版間の差分

提供: 初心者エンジニアの簡易メモ
ナビゲーションに移動 検索に移動
編集の要約なし
編集の要約なし
115行目: 115行目:
rm -rf /tmp/sessions/*
rm -rf /tmp/sessions/*
php -r "opcache_reset();"
php -r "opcache_reset();"
</pre>
===Model_Paginatorの$_current_page is deprecated警告==
エラー詳細
<pre>
Runtime Deprecated code usage!
Fuel\Core\PhpErrorException [ Runtime Deprecated code usage ]:
Creation of dynamic property Model_Paginator::$_current_page is deprecated
</pre>
修正方法
<pre>
class Model_Paginator
{
  private $_contents = array();
  private $_pager;
  private $_per_page = 30; // 1ページ内のコンテンツ数
  private $_num_links = 3; // ページリンク数の半分
  private $_pagination_url;
  private $_current_page; // これを追加
</pre>
</pre>



2026年4月30日 (木) 18:42時点における版

fuelphp1.9へバージョンアップ

composer.json更新

{
    "name": "fuel/fuel",
    "type": "project",
    "description" : "FuelPHP is a simple, flexible, community driven PHP 8.1+ framework, based on the best ideas of other frameworks, with a fresh start!",
    "keywords": ["application", "website", "development", "framework", "PHP"],
    "license": "MIT",
    "repositories": [
        { "type": "vcs", "url": "https://github.com/fuel/docs" },
        { "type": "vcs", "url": "https://github.com/fuel/core" },
        { "type": "vcs", "url": "https://github.com/fuel/auth" },
        { "type": "vcs", "url": "https://github.com/fuel/email" },
        { "type": "vcs", "url": "https://github.com/fuel/oil" },
        { "type": "vcs", "url": "https://github.com/fuel/orm" },
        { "type": "vcs", "url": "https://github.com/fuel/parser" }
    ],
    "require": {
        "php": ">=8.1",
        "composer/installers": "^2.3",
        "fuel/docs": "dev-1.9/develop",
        "fuel/core": "dev-1.9/develop",
        "fuel/auth": "dev-1.9/develop",
        "fuel/email": "dev-1.9/develop",
        "fuel/oil": "dev-1.9/develop",
        "fuel/orm": "dev-1.9/develop",
        "fuel/parser": "dev-1.9/develop",
        "fuelphp/upload": "2.0.2",
        "monolog/monolog": "^3.0",
        "phpseclib/phpseclib": "~3.0",
        "michelf/php-markdown": "~1.9"
    },
    "suggest": {
        "dwoo/dwoo" : "Allow Dwoo templating with the Parser package",
        "mustache/mustache": "Allow Mustache templating with the Parser package",
        "smarty/smarty": "Allow Smarty templating with the Parser package",
        "twig/twig": "Allow Twig templating with the Parser package",
        "pyrocms/lex": "Allow Lex templating with the Parser package",
        "mthaml/mthaml": "Allow Haml templating with Twig supports with the Parser package"
    },
    "config": {
        "vendor-dir": "fuel/vendor",
        "allow-plugins": {
            "composer/installers": true
        }
    },
    "extra": {
        "installer-paths": {
            "fuel/{$name}": ["fuel/core"],
            "{$name}": ["fuel/docs"]
        }
    },
    "scripts": {
        "post-install-cmd": [
            "php oil r install"
        ]
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

ja_JP.UTF-8なエラーが起こる場合

エラー詳細

Fuel\Core\PhpErrorException [ Fatal Error ]: The configured locale(s) "ja_JP.UTF-8" can not be found on your system.

以下インストール対応

sudo dnf install -y glibc-langpack-ja


ja_JP.UTF-8なエラーが起こる場合(ページ更新で出たり出なかったり)

調査

$ locale -a | grep ja
ja_JP.eucjp
ja_JP.utf8

fuel/app/config/config.php

- 'locale'            => 'ja_JP.UTF-8',
+ 'locale'            => 'ja_JP.utf8',

array_key_existsエラーが起こる場合

エラー詳細

Fuel\Core\PhpErrorException [ Runtime Deprecated code usage ]: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead DOCROOT/index.php @ line 66

対応方法

修正前

array_key_exists($route, Router::$routes)


修正後

$route = $route ?? '';

$route = array_key_exists($route, Router::$routes)
    ? Router::$routes[$route]->translation
    : Config::get('routes.'.$route);


keyのLengthExceptionが起こるとき

エラー詳細

LengthException [ Error ]:Key of size 18 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported

対応方法

セッション削除

rm -rf fuel/app/cache/*
rm -rf /tmp/sessions/*
php -r "opcache_reset();"

=Model_Paginatorの$_current_page is deprecated警告

エラー詳細

Runtime Deprecated code usage!
Fuel\Core\PhpErrorException [ Runtime Deprecated code usage ]:
Creation of dynamic property Model_Paginator::$_current_page is deprecated

修正方法

class Model_Paginator
{
   private $_contents = array();
   private $_pager;
   private $_per_page = 30; // 1ページ内のコンテンツ数
   private $_num_links = 3; // ページリンク数の半分
   private $_pagination_url;

   private $_current_page; // これを追加

fuelphp1.8.2へバージョンアップ

composer.json


    "require": {
        "php": ">=5.3.3",
        "composer/installers": "~1.0",
        "fuel/docs": "1.7.*",
        "fuel/core": "1.7.*",
        "fuel/auth": "1.7.*",
        "fuel/email": "1.7.*",
        "fuel/oil": "1.7.*",
        "fuel/orm": "1.7.*",
        "fuel/parser": "1.7.*",
        "fuelphp/upload": "2.0.2",
        "monolog/monolog": "1.5.*",
        "phpseclib/phpseclib": "2.0.0",
        "michelf/php-markdown": "1.4.0"
    },

composer.json


    "require": {
        "php": ">=5.3.3",
        "composer/installers": "~1.0",
        "fuel/docs": "1.8.*",
        "fuel/core": "1.8.*",
        "fuel/auth": "1.8.*",
        "fuel/email": "1.8.*",
        "fuel/oil": "1.8.*",
        "fuel/orm": "1.8.*",
        "fuel/parser": "1.8.*",
        "fuelphp/upload": "2.0.2",
        "monolog/monolog": "1.5.*",
        "phpseclib/phpseclib": "2.0.0",
        "michelf/php-markdown": "1.4.0"
    },

バージョンアップ

composer update