LoginSignup
11
10

More than 5 years have passed since last update.

クソ実装した人を殴りたい?ならばこれ!PHPのsecret-blame拡張でいつでもお手軽blame!

Last updated at Posted at 2013-05-28

PHP用の拡張、secret_blameは

       ______
    /          )))
   /   /// /―――-ミ
   / 彡彡 // /      ヽ))
   / 彡彡 iiiiiiiiiiiiiii  iiiiiiiiii|
   / 彡彡 < ・ > 、<・ >l
  /    |       ヽ   〉
  /  ( | |      __)  |    / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
  /   | ≡  /, ―――  |ゝ < この クソ実装したのは誰じゃ!
  /   |   |  L ___」 l ヾ  \_________
_ミ  l   ______ノ ゞ_
  |  l ヾ    ー   / |  l
  |  |   \ー    ‐/  |  | 

というあなたのための拡張です。
https://github.com/willhf/secret_blame
から入手できます。

試しに、下記のようなスクリプトを実行すると、

<?php

class SuperUtil
{
    public static function doMagic()
    {  
        fopen('/magicians_note', 'r');
    }
}

SuperUtil::doMagic();

 PHP Warning:  Guilty: sasezaki: fopen(/magicians_note): failed to open stream: No such file or directory in /home/sasezaki/var/www/sample.php on line 7

と誰が実装したのか分かります。
こんな拡張、チームメンバの開発環境に入れてもらえない?大丈夫!secret_blameはphpinfo()やphp -m では表示されません。こっそり入れられます。あと、たまたまですがxdebugと同時には動かせません(なので試す方はxdebugを一度オフに)。なので本番環境でこけたときにより表示する機会が増えるということですね!燃え上がりたい方におすすめ!

……というネタを通してPHP拡張の仕組みを学べるのがsecret_blameです。(上記リポジトリにスライドが付属)

11
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
10