ミライハック
  • Home
  • Categories
  • About

>> Home / LInux

FuelPHPのバリデーションエラーが出た時の対処

∵ Takayoshi Saito ∴ 2016-12-21 ∞ 1'

Validationでエラーが出たら

FuelPHPで以下のエラーが出た場合の対処法。

RuntimeException [ Error ]:
Object class "Fuel\Core\Validation" could not be converted to string or sanitized 
asArrayAccess. Whitelist it in security.whitelisted_classes in app/config/config.php t
o allow it to be passed unchecked.
COREPATH/classes/security.php @ line 268
// Throw exception when
it wasn't whitelisted and can't be converted to String
if ( ! method_exists($value, '__toString'))
{
throw new \RuntimeException('Object class "'.get_class($value).'" could not be converted to string or '.
'sanitized as ArrayAccess. Whitelist it in security.whitelisted_classes in app/config/config.php '.
'to allow it to be passed unchecked.');
  }
$value = static::htmlentities((string) $value, $flags, $encoding, $double_encode);

config/config.phpを編集

config/config.phpに'Fuel\Core\Validation',を追加します。


'whitelisted_classes' => array(
    'Fuel\\Core\\Response',
    'Fuel\\Core\\View',
    'Fuel\\Core\\ViewModel',
    'Fuel\\Core\\Validation',
    'Closure',
),

これでエラーは出なくなります。

Search

Categories
  • LInux
  • インターネット
  • インフラ
  • エッセイ
  • ゲーム
  • システム開発
  • セキュリティ
  • データサイエンス
  • 国際関係
  • 政治
  • 歴史
  • 社会学
  • 自己紹介
  • 行ってきた

Pages
  • 齊藤貴義
  • 職務経歴
  • スクレイピング・ハッキング・ラボ サポートページ
  • 『爆速開発を支えるClaude Code上級者テクニック』サポートページ

2026 © Takayoshi Saito | Twitter GitHub | Built on Zola