advanced-cache.phpにsanitize_text_fieldが含まれてエラーが発生する

TOP Forums バグ報告と提案(Requests and Feedback) advanced-cache.phpにsanitize_text_fieldが含まれてエラーが発生する

advanced-cache.phpにsanitize_text_fieldが含まれてエラーが発生する

Viewing 1 reply thread
  • Author
    Posts
    • #1590
      yugo
      Participant

        必要があり、デバイス切替機能を利用し、かつPC/SP切替ボタンをフッターに表示する機能を作成しています。
        実装はできたのですが、テストすると

        #7 {main}
          thrown in /home/kusanagi/xxxxx/DocumentRoot/wp-content/advanced-cache.php on line 217" while reading response header from upstream, client: 141.101.87.60, server: xxxxx.example.net, request: "GET /?site-view=smart HTTP/2.0", upstream: "fastcgi://127.0.0.1:9000", host: "xxxxx.example.net", referrer: "https://xxxxx.example.net/?site-view=pc"
        2025/11/25 20:25:46 [error] 1917632#1917632: *8577 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function sanitize_text_field() in /home/kusanagi/xxxxx/DocumentRoot/wp-content/advanced-cache.php:217

        このようなエラーになります。

        いろいろ調べてみましたが、tpl側にsanitize_text_fieldが入っており、phpを修正しても再生成でNG、tplを修正してもアップデートでNGという状況です。

        マニュアルをチェックし、各種アップデートも行い、11/14の最新更新が適用されています。

        お手数ですが、この状況はこちらの環境の問題なのか教えていただきたいです。

        [kusanagi@xxxx ~]$ ll /opt/kusanagi/lib64/kusanagi/resource/DocumentRoot/wp-content/mu-plugins/kusanagi-core/advanced_cache_tpl
        合計 20
        -rw-r--r-- 1 kusanagi www 7562 11月 14 15:38 advanced-cache.tpl
        -rw-r--r-- 1 kusanagi www   28 11月 14 15:38 index.php
        -rw-r--r-- 1 kusanagi www  226 11月 14 15:38 regex_include.tpl
        -rw-r--r-- 1 kusanagi www  586 11月 14 15:38 replace-class.tpl
        [kusanagi@xxxx ~]$ cat /opt/kusanagi/lib64/kusanagi/resource/DocumentRoot/wp-content/mu-plugins/kusanagi-core/advanced_cache_tpl/advanced-cache.tpl | grep "sanitize_text_field"
        if ( strtolower( sanitize_text_field( $_GET['site-view'] ) ) === strtolower( $group ) ) {
        [kusanagi@xxxx ~]$ 
        [kusanagi@xxxx ~]$ kusanagi status
        KUSANAGI Version 9.7.2-1.el9
        sakura
        CentOS Stream 9
        
        *** (active) nginx : nginx127 ***
        * nginx127.service - The NGINX HTTP and reverse proxy server
             Loaded: loaded (/usr/lib/systemd/system/nginx127.service; enabled; preset: disabled)
             Active: active (running) since Tue 2025-11-25 21:51:58 JST; 12h ago
        
        *** (inactive) httpd : httpd24 ***
        * httpd.service - The Apache HTTP Server
             Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled)
             Active: inactive (dead)
        
        *** (active) php : php84 ***
        * php-fpm.service - The PHP FastCGI Process Manager
             Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; preset: disabled)
             Active: active (running) since Tue 2025-11-25 21:51:58 JST; 12h ago
        
        *** (inactive) mariadb : mariadb10.6 ***
        * mariadb.service - MariaDB 10.6.24 database server
             Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: disabled)
             Active: inactive (dead) since Wed 2025-02-12 12:00:46 JST; 9 months 13 days ago
        
        *** (inactive) psql :  ***
        
        *** (inactive) pgpool-II :  ***
        
        *** python ***
        Python 3.12.12
        
        *** Cache status ***
        
        *** WAF ***
        off
        
        *** SELinux ***
        off (permanent)
        
        status completed.
        • This topic was modified 3 weeks, 1 day ago by yugo.
      • #1592
        obunsho
        Moderator

          yugoさん、こんにちは。
          いただいた状況から考えると、以下の点が原因として可能性があると思いますので、調整方法を提案します。

          1,kusanagi-wp-plugins が古い可能性
          最新バージョンは1.4.1です。
          まずは以下で現在のバージョンを確認してみてください。
          cat /home/kusanagi/{profile}/DocumentRoot/wp-content/mu-plugins/wp-kusanagi.php
          もし古い場合は、次のコマンドで更新できます。
          dnf update kusanagi-wp-plugins
          kusanagi update plugin {プロファイル名}

          2,advanced-cache.phpが古いキャッシュのままになっている可能性
          テーマ切り替えや設定変更後、advanced-cache.phpが更新されず、以前の内容が使われ続けてしまうことがあります。
          一度、ページキャッシュの画面からキャッシュをクリアして、advanced-cache.phpを再生成して、
          最新の状態にしてから確認してみてください。

          進展があれば共有してください。

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.

      Next article

      フォーラムについて