プロジェクト

全般

プロフィール

Enhancement(機能追加・改善) #3919

PHP 5.6 対応

kaoru n約8年前に追加. ほぼ8年前に更新.

ステータス:
Fixed(完了)
優先度:
Immediate(今すぐ)
担当者:
対象バージョン:
開始日:
2016-03-18
期日:
2016-06-09
進捗率:

100%


説明

Overview (概要)

PHP 5.6 への対応を行う

1. 問題点の洗い出し
2. PHP 5.3 以降のアップデート情報を元になくなったメソッドが使用されていないかなどを調査する

Spec (仕様)


関連するチケット

関連している OpenPNE 3 - Bug(バグ) #3918: PHP 5.5 以降でプラグインの展開に失敗する Won't fix(対応せず) 2016-03-14

履歴

#1 kaoru n約8年前に更新

  • 優先度Normal(通常) から Immediate(今すぐ) に変更

#2 kaoru n約8年前に更新

  • 関連している Bug(バグ) #3918: PHP 5.5 以降でプラグインの展開に失敗する を追加

#4 kaoru n約8年前に更新

  • ステータスNew(新規) から Accepted(着手) に変更

#5 Youichi Kimura約8年前に更新

PHP5.6.18 で dev モードの pc_frontend (pc_frontend_dev.php) を開くと以下のように警告が出力されます。

Warning: ob_start(): function '' not found or invalid function name in /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/config/sfApplicationConfiguration.class.php on line 155

Notice: ob_start(): failed to create buffer in /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/config/sfApplicationConfiguration.class.php on line 155

Notice: Array to string conversion in /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Query/Abstract.php on line 1152

(上の一行と同じ Notice が 15 回繰り返し)

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 409

(上の一行と同じ Deprecated が 3 回繰り返し)

Deprecated: Non-static method Net_UserAgent_Mobile::factory() should not be called statically, assuming $this from incompatible context in /home/upsilon/git/openpne3/master/lib/util/opMobileUserAgent.class.php on line 32

Deprecated: Non-static method Net_UserAgent_Mobile::isDoCoMo() should not be called statically, assuming $this from incompatible context in /home/upsilon/git/openpne3/master/lib/vendor/PEAR/Net/UserAgent/Mobile.php on line 144

Deprecated: Non-static method Net_UserAgent_Mobile::isEZweb() should not be called statically, assuming $this from incompatible context in /home/upsilon/git/openpne3/master/lib/vendor/PEAR/Net/UserAgent/Mobile.php on line 146

Deprecated: Non-static method Net_UserAgent_Mobile::isSoftBank() should not be called statically, assuming $this from incompatible context in /home/upsilon/git/openpne3/master/lib/vendor/PEAR/Net/UserAgent/Mobile.php on line 148

Deprecated: Non-static method Net_UserAgent_Mobile::isWillcom() should not be called statically, assuming $this from incompatible context in /home/upsilon/git/openpne3/master/lib/vendor/PEAR/Net/UserAgent/Mobile.php on line 150

Deprecated: Non-static method PEAR::staticPushErrorHandling() should not be called statically, assuming $this from incompatible context in /home/upsilon/git/openpne3/master/lib/vendor/PEAR/Net/UserAgent/Mobile.php on line 170

Deprecated: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /home/upsilon/git/openpne3/master/lib/vendor/PEAR/Net/UserAgent/Mobile/Common.php on line 140

Deprecated: Non-static method PEAR::staticPopErrorHandling() should not be called statically, assuming $this from incompatible context in /home/upsilon/git/openpne3/master/lib/vendor/PEAR/Net/UserAgent/Mobile.php on line 172

Deprecated: Non-static method Net_UserAgent_Mobile::isError() should not be called statically, assuming $this from incompatible context in /home/upsilon/git/openpne3/master/lib/vendor/PEAR/Net/UserAgent/Mobile.php on line 174

Warning: Cannot modify header information - headers already sent by (output started at /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/response/sfWebResponse.class.php:409) in /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 336

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 409

Warning: Cannot modify header information - headers already sent by (output started at /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/response/sfWebResponse.class.php:409) in /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 357

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/upsilon/git/openpne3/master/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 409

どの警告も動作に支障を来すものではありませんが、最初に出力される Warning については ./symfony openpne:install などタスクの実行時にも出力される (#3887) ため、「正常動作なのに Warning が表示される」という意味では利用者に余計な不安を与えるかもしれません。

その他の警告については一般のユーザーが目にすることはありませんが、「開発者が dev モードで見たときに本来気付くべき警告が埋もれてしまう」という懸念はあります。

#6 Youichi Kimura約8年前に更新

PHP 5.6.x における下位互換性の無い変更点

https://secure.php.net/manual/ja/migration56.incompatible.php

  • 配列リテラルを用いてクラスのプロパティに配列を設定した場合、配列のキーが上書きされない
    • 「クラスのプロパティとして宣言されている配列で明示的なキーと暗黙のキーが混在している場合」という特殊な条件下でキーが上書きされる動作が修正されたもの。これを意図的に起こすようなコードが存在するとは考えにくく(おそらくレビュー段階で止められるであろう)、かつ単純な grep 等では該当する箇所を探すことは困難であることから無視
  • json_decode() が、より厳格に
    • OpenPNE で外部から JSON データを受け取るために json_decode 関数を使用しているのは opSecurityUser::getRememberLoginCookie() のみであり、このメソッドはopSecurityUser::setRememberLoginCookie() によってセットされた Cookie から JSON を読み出している。閲覧者が意図的に Cookie を書き換えるような状況でない限り json_decode が厳格になることで問題が起こることはない
  • ストリームラッパーが、SSL/TLS を使っている場合のピア証明書とホスト名の検証にデフォルトで対応
  • GMP リソースがオブジェクトに
    • GMP 関数は lib/vendor/php-openid/Auth/OpenID/BigMath.php 内で使われているが、GMP リソースに対して is_resource() 関数を使用する箇所は見当たらなかった
  • Mcrypt 関数は、有効なキーと IV を要求する
    • OpenPNE で mcrypt_* 関数が使われているのは 1849103f の箇所のみ
    • 部分 SSL を有効にし User-Agent を au 携帯のものに設定して正常にログインできることを確認した
  • cURL でのファイルアップロード
    • CURLOPT_POSTFIELDS のパラメータに "@filename.txt" の形式でファイルパスを記述するとファイルアップロードを行える機能がデフォルトで無効化された。grep で @ から始まる文字列を検索してみたが curl のパラメータのために用いている箇所は見付からなかった

PHP 5.5.x における下位互換性の無い変更点

https://secure.php.net/manual/ja/migration55.incompatible.php

  • Windows XP および 2003 のサポートの終了
  • 大文字小文字を区別しない比較がロケールに依存しなくなる
    • トルコ語のように「i」(U+0069) と「I」(U+0049) が case-insensitive な比較でも異なる文字として扱われるロケールで発生する問題。これが今後は特定のロケールによって挙動が変化しなくなるため、今まで日本語圏で問題が起きていないのであれば今後も問題は起きないはず
  • pack() と unpack() の変更
    • pack/unpack 関数の書式文字 "A", "a" を使用している箇所は #3918 の Archive_Tar 以外では見付からなかった
  • self や parent そして static が、どんな場合であっても大文字小文字を区別しないようになる
    • SELF::CONSTANT のような書き方ができるようになる、という変更なので既存のコードに影響するものではない
  • PHP ロゴの GUID の削除
    • *_guid() 関数を使用している箇所は見付からなかった
  • 内部的な実行方法の変更
    • 拡張モジュールの開発者などを除いては基本的に影響しない

その他の変更点

#7 Youichi Kimuraほぼ8年前に更新

PHP 5.6.x から TLS/SSL を使用する全ての通信においてピア証明書およびホスト名の検証がデフォルトで行われるようになります。
通常は通信先のサーバーが正しい証明書を使用していれば特別に対策を取る必要はありません。ただし、もし PHP 5.6.x に移行したことで下記に挙げる機能が動作しなくなった場合は、証明書の検証に失敗したことが原因であると考えられます。

影響を受ける機能の例:

  • OpenPNE.yml の mail_smtp_host を使用したメール送信
  • メンバーの「BlogのURL設定」 (opBlogPlugin)
  • OpenID によるログイン (opAuthOpenIDPlugin)

これらの機能でエラーが発生する場合は、通信先のサーバーの証明書に問題がある(自己署名証明書を使用している、中間証明書が設定されていない、ホスト名と CN が一致しないなど)か、OpenPNE が設置されているサーバーに CA バンドルが正しくインストールされていないなどの理由が考えられます。

参照: PHP 5.6.x における OpenSSL 関連の変更

#8 Youichi Kimuraほぼ8年前に更新

PHP 5.6 以降で APC が使用できない点について調査:

  • OpenPNE に含まれるクラスでは sfAPCCache, Doctrine_Cache_Apc クラスが APC の apc_store, apc_fetch 等の関数を使用している
  • 実際に OpenPNE で使われているのは Doctrine_Cache_Apc のみで、APC が利用可能な場合のみ有効となる
  • Doctrine_Cache_Apc は Query Cache に使用されており、DQL をパースし SQL を生成した結果がキャッシュされている
    • Doctrine のドキュメントには“You should always use query cache in a production environment.”と記載されている

APCu 拡張について:

  • APC から User Cache 以外の機能を削った APCu が存在する (PHP 5.6 でも動く)
  • APCu のビルド時に --enable-apc-bc=yes (デフォルト) の状態であれば apc_store, apc_fetch 等の関数はそのまま動く
    • この場合、extension_loaded('apc') も true を返す
  • APCu が入った状態で Doctrine のクエリキャッシュが正常に動作していることを確認済み

#9 kaoru nほぼ8年前に更新

  • ステータスAccepted(着手) から Fixed(完了) に変更
  • 進捗率0 から 100 に変更

#10 Youichi Kimuraほぼ8年前に更新

#3919-8 の APUu 拡張モジュールについては #3957 にて扱っています

他の形式にエクスポート: Atom PDF