Upgrade to Pro — share decks privately, control downloads, hide ads and more …

あの日見たバグを僕達はまだ公式ドキュメントで見れない / The bug we saw that day

あの日見たバグを僕達はまだ公式ドキュメントで見れない / The bug we saw that day

2017/01/31 PHP 勉強会 での LT 資料です

B70c88a9a107334fa64a69e010af3cc6?s=128

Yoshihide Taniguchi

January 31, 2017
Tweet

Transcript

  1. ୩ޱఓӳ!SBWFMMM ͋ͷ೔ݟͨόάͷৄࡉΛ ๻ୡ͸·ͩ ެࣜυΩϡϝϯτͰ ݟΕͳ͍

  2. ࠓ೔࿩͢͜ͱ w1)1ͷόʔδϣϯΞοϓதʹ౿Μͩόάʹ͍ͭͯ wܦҢ wࣄ݅ wରԠ

  3. ୩ޱఓӳ@ravelll ( ͨʹ͙ͪc͙ͬ͞Μ ͱݺ͹Ε͍ͯ·͢

  4. 1)1ͷόʔδϣϯΞοϓΛ΍͍ͬͯͨ w͋Δ8FCΞϓϦέʔγϣϯͷϩʔϧ $ wc -l $(find . -name \*.php) |

    tail -1 
 325048 total w1)11)1 wίʔυमਖ਼͕΄΅΄΅׬ྃɺಈ࡞ݕূΛ͍ͯͨ͠
  5. ͋Εͬ͜ͷػೳಈ͔ͳ͍ʜ wϖʔδʹΞΫηεͨ͠ΒඇಉظʹσʔλΛऔಘɾඳը w"KBYͰ(&5ͯ͠KTPOड͚औͬͯඳը wKTPOऔಘ࣌ʹ1)1ଆͰΤϥʔ͕ग़͍ͯͨ •PHP Warning: mb_convert_variables(): Cannot handle recursive

    references in ʙ
  6. mb_convert_variables()

  7. NC@DPOWFSU@WBSJBCMFT ͱ͸ʁ wม਺ͷ஋ͷΤϯίʔσΟϯάΛม׵͢Δؔ਺ ex) mb_convert_variables(‘UTF-8’, ’EUC-JP’, $var); w$varʹ͸4USJOH "SSBZ 0CKFDUΛ౉ͤΔ

    wNC@DPOWFSU@FODPEJOHͱҾ਺ͷॱ͕ҧ͏ʢ͔Θ͍͍ʣ mb_convert_variables($to_enc, $from_enc, $var); mb_convert_encoding($str, $to_enc[, $from_enc]);
  8. Cannot handle recursive references in …

  9. Cannot handle recursive references in …

  10. SFDVSTJWFͳSFGFSFODFTʁ

  11. wͦΜͳ഑ྻ͸౉͍ͯ͠ͳ͍ͧʜʁ wͱ͍͏͔ [‘a’, ‘b’] Ͱ͢Βಉ͡ΤϥʔʹͳΔͧʁʁʁ ‎Ͳ͔͜ͷόʔδϣϯͰ࢓༷͕มΘͬͨʹҧ͍ͳ͍ʂ
 ެࣜυΩϡϝϯτΛಡ΋͏ʂʂ

  12. None
  13. ಛʹݴٴ͞Εͯͳ͍

  14. ΢ʔϜࠔͬͨʜ wόʔδϣϯΞοϓલޙͰ1)1ͷιʔεΛಡΈൺ΂ͯΈͨ΋ͷͷ
 $ݴޠྗ͕௿ͯ͘࠶ؼࢀরΛݕ஌͢Δ࢓૊Έ͕૿͑ͯΔ͜ͱҎ֎Α ͘෼͔Βͳ͍ʜ wNC@DPOWFSU@FODPEJOHؔ਺Λ࢖͏Α͏ʹΞϓϦέʔγϣϯͷ࣮૷ Λ௚͍͔ͯ͘͠͠ͳ͍ͷ͔ʜ͍΍Ͱ΋݁ߏ࢖ͬͯΔͱ͜Ζ͋Δʜ

  15. None
  16. None
  17. Ξοοο

  18. ؔ਺ͷόάͩͬͨ໛༷ ‣ୈҾ਺ʢม׵ݩͷΤϯίʔσΟϯάʣʹͭҎ্ͷΤϯίʔσΟϯ άΛࢦఆͨ͠ͱ͖ɺม׵ର৅ͷ"SSBZͷ࠶ؼతࢀরͷݕ͕ࠪਖ਼ৗʹ Ͱ͖ͳ͍ ex) mb_convert_variables(‘UTF-8’, ‘EUC-JP,Shift_JIS’, $val); mb_convert_variables(‘UTF-8’, ‘auto’,

    $val); (‘auto’ ͸ΤΠϦΞεͰɺmbstring.language=Japanese
 ͷͱ͖ͳΒ ‘ASCII,JIS,UTF-8,EUC-JP,SJIS’)
  19. मਖ਼ϓϧϦΫग़ͯͨʢʣ ‣·͞ʹɺͳςετ͕௥Ճ͞Ε͍ͯͨʜʂ

  20. ରԠ wόά͕ੜ·ΕΔ௚લͷόʔδϣϯʢʣΛ࢖͏͜ͱʹͨ͠ w΋͏1)1ܥ΋"DUJWF4VQQPSUͰͳ͘ͳΓେ͖ͳػೳ௥ Ճ͕ͳ͍ wࠓؤுͬͯͱ͔ʹ͢ΔΑΓ͸9ʹ͢΂͘ؤுͬͨ ΄͏͕Α͍ͷͰ͸ʜʁ

  21. ·ͱΊ wόʔδϣϯΞοϓதʹݴޠͷόάͱग़ձͬͨ࿩Λڞ༗͠·ͨ͠ wNC@DPOWFSU@WBSJBCMFTͰϋϚͬͨ wݪҼ͕υΩϡϝϯτʹॻ͔Εͯͳ͔ͬͨ
 ʢݴٴͨ͠Ϣʔβίϝϯτ͸͋ͬͨʣ wؔ਺ࣗମʹόά͕͋Δ͜ͱ͕෼͔ͬͨ w1)1Λ࢖͏͜ͱͰҰ୴ճආͨ͠