[OpenPNE3]3.0.0のindex.phpを消す

Written by uechoco 2月 01
このエントリをはてなブックマークに追加[OpenPNE3]3.0.0のindex.phpを消すのはてなブックマーク被リンク数このエントリをdel.icio.usに追加このエントリをLivedoor Clipに追加このエントリをBuzzurl(バザール)に追加

prod環境のno_script_nameがonになってるのにindex.phpが消えないOpenPNE3ですが、果てしない旅の結果、ただのバグでした。

旅の経路:

  • UrlHelper内link_to()関数
  • UrlHelper内url_for()関数
  • sfWebController->genUrl()メソッド
  • sfPatternRouting->generate()メソッド
  • sfRouting->fixGeneratedUrl()メソッド
  • cache内config_factories.yml.phpファイル
  • sfOpenPNEWebRequest->__construct()メソッド
  • sfRequest->__construct()メソッド
  • sfWebRequest->initialize()メソッド
  • sfOpenPNEWebRequest->initialize()メソッド

で、sfWebRequest->initialize()とsfOpenPNEWebRequest->initialize()を比較した結果、sfOpenPNEWebRequest->initialize()の第4引数がないことに気付きました。第4引数$optionsを追加して、試しに$optionsの内容をprint_rしたところ、

TEXT:
  1. Array (     [logging] =>      [path_info_array] => SERVER     [path_info_key] => PATH_INFO     [relative_url_root] =>      [formats] => Array         (             [txt] => text/plain             [js] => Array                 (                     [0] => application/javascript                     [1] => application/x-javascript                     [2] => text/javascript                 )              [css] => text/css             [json] => Array                 (                     [0] => application/json                     [1] => application/x-json                 )              [xml] => Array                 (                     [0] => text/xml                     [1] => application/xml                     [2] => application/x-xml                 )              [rdf] => application/rdf+xml             [atom] => application/atom+xml         )      [no_script_name] => 1 )

と、no_script_name => 1が伝搬されてきました。あとは、これをparent::initialize()の第4引数として渡してやると、無事にindex.phpが消えました。

結論:

sfOpenPNEWebRequest.class.phpのsfOpenPNEWebRequest->initialize()メソッドを

php:
  1. public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array())
  2. {
  3. parent::initialize($dispatcher, $parameters, $attributes);
  4.  
  5. require_once 'Net/UserAgent/Mobile.php';
  6. }

から

php:
  1. public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array(), $options = array())
  2. {
  3. parent::initialize($dispatcher, $parameters, $attributes, $options);
  4.  
  5. require_once 'Net/UserAgent/Mobile.php';
  6. }

に変えるだけ。たぶんOpenPNE3.0.1とかでは既に治ってると思います。

このエントリをはてなブックマークに追加[OpenPNE3]3.0.0のindex.phpを消すのはてなブックマーク被リンク数このエントリをdel.icio.usに追加このエントリをLivedoor Clipに追加このエントリをBuzzurl(バザール)に追加

2 Responses to “[OpenPNE3]3.0.0のindex.phpを消す”

  1. コメント by 海老原昂輔 on 2009 年 2 月 1 日 21 : 02 : 28

    OpenPNE開発チームの海老原です。ご報告いただきありがとうございます!

    http://trac.openpne.jp/changeset/10592
    で修正したのでご確認いただければと思います。

  2. コメント by uechoco on 2009 年 2 月 1 日 21 : 04 : 58

    確認しました!素早い対応ありがとうございます

Comments RSS rss うえちょこ@ぼろぐ TrackBack Identifier URI rss うえちょこ@ぼろぐ

コメントをどうぞ