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

比較演算を壊してみる / php-break-comparison

yammerjp
September 27, 2022

比較演算を壊してみる / php-break-comparison

PHP Tech Cafe / PHPerのための「PHPカンファレンス2022」を語り合う - LT
2022/09/27

PHP Conference Japan 2022でおもしろいと感じた以下の発表を参考にさせていただき、手を動かしてみました。
https://fortee.jp/phpcon-2022/proposal/8f29f20e-1275-49eb-89c0-fe684e28d110

php-srcの比較演算の挙動を何らか変更することを目標に、その手順を紹介しています。

yammerjp

September 27, 2022
Tweet

More Decks by yammerjp

Other Decks in Programming

Transcript

  1. தࢁܚ༞ ΍Μ·ʔ

    ൺֱԋࢉΛյͯ͠ΈΔ
    1)15FDI$BGF1)1FSͷͨΊͷʮ1)1ΧϯϑΝϨϯεʯΛޠΓ߹͏

    View full-size slide

  2. ͸͡Ί·ͯ͠
    1)15FDI$BGFʹ͸͡ΊͯࢀՃ͍͖ͤͯͨͩ͞·͢
    Ͳ͏ͧΑΖ͓͘͠ئ͍͍ͨ͠·͢

    View full-size slide

  3. தࢁܚ༞
    w ৬ۀ8FCΞϓϦέʔγϣϯ
    ΤϯδχΞ ʙ

    w 1)1ྺ೥͘Β͍
    w झຯEPU
    fi
    MFTͷ؅ཧ
    w 5XJUUFS(JU)VCZBNNFSKQ
    ΍Μ·ʔ

    View full-size slide

  4. 1)1$POGFSFODFʹొஃ͍ͯ͠·ͨ͠
    ʙ ͍ͪ͹Μ࠷ॳͷηογϣϯ

    ೥ଓ͘8FCΞϓϦέʔγϣϯΛվળ͢Δʙ৽ଔ೥໨͔ΒΈΔΧϥʔϛʔγϣοϓʙ
    IUUQTTQFBLFSEFDLDPNZBNNFSKQJODSFNFOUBMJNQSPWFNFOUCZEFWJTJOHBQQMJDBUJPODIBOHFCPVOEBSJFT

    View full-size slide

  5. lൃද಺༰ΛউखʹৼΓฦΓ·͢z
    ࠓ೔ͷςʔϚʮ1)1ΧϯϑΝϨϯεʯΛޠΓ߹͏
    ͋ΔηογϣϯΛΈͯखΛಈ͔ͨ͜͠ͱʹ͍ͭͯ࿩͠·͢
    IUUQTSBLVTDPOOQBTTDPNFWFOU

    View full-size slide

  6. l೥΋ͷͷڊେϨΨγʔϓϩμΫτΛ1)1
    ʹΞοϓσʔτͨ͠ࡍͷରࡦͱಘΒΕͨ஌ݟz
    ໘ന͔ͬͨηογϣϯ
    ʙ5SBDL
    IUUQTGPSUFFKQQIQDPOQSPQPTBMGGFFCDGFFE

    View full-size slide

  7. IUUQTGPSUFFKQQIQDPOQSPQPTBMGGFFCDGFFE
    l೥΋ͷͷڊେϨΨγʔϓϩμΫτΛ1)1
    ʹΞοϓσʔτͨ͠ࡍͷରࡦͱಘΒΕͨ஌ݟz
    w1)1ͷϥϯλΠϜʹಠࣗͷύονΛ౰ͯΔ
    wͱඇޓ׵ͳൺֱԋࢉ࣌ʹ&@8"3/*/(Λग़͢
    ൃදͰ঺հ͞Ε͍ͯͨɺΞοϓσʔτͷࣄલௐࠪͰͱΒΕͨํ๏

    View full-size slide

  8. 1)1ˠͰɺൺֱԋࢉͷڍಈ͕͔ΘΔ
    bTUSJOH`
    1)1
    ˠUSVF
    1)1
    ˠGBMTF

    View full-size slide

  9. 1)1ˠͰɺൺֱԋࢉͷڍಈ͕͔ΘΔ
    bTUSJOH`
    1)1
    ˠUSVF
    1)1
    ˠGBMTF
    &@8"3/*/(Λ
    ൃੜͤ͞Δ

    View full-size slide

  10. ΍ͬͯΈ͍ͨ
    ΊͪΌͪ͘Ό໘നͦ͏༗༻ͦ͏ͳͷͰɺಉ͜͡ͱΛ΍ͬͯΈ͍ͨ

    View full-size slide

  11. Ͱ΋ɺ1)1ຊମʹ
    खΛೖΕͨ͜ͱ͸ͳ͍ʜ

    View full-size slide

  12. ΰʔϧൺֱԋࢉΛյͯ͠ΈΔ
    ಉ༷ͷ࣮૷͸೉қ౓͕ߴ͍ͷͰɺ·ͣ͸ൺֱԋࢉͷڍಈ͕ԿΒ͔มߋ
    ͞Εͨ1)1Λͭͬͯ͘ΈΔ͜ͱʹ͢Δ

    View full-size slide

  13. ΞδΣϯμ
    wQIQTSDΛϏϧυ͢Δ
    w1)1ͷൺֱԋࢉॲཧͷ࣮૷Λ୳͢
    w1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ ڍಈΛมߋ͢Δ


    View full-size slide

  14. ΞδΣϯμ
    wQIQTSDΛϏϧυ͢Δ
    w1)1ͷൺֱԋࢉॲཧͷ࣮૷Λ୳͢
    w1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ ڍಈΛมߋ͢Δ


    View full-size slide

  15. QIQTSDΛϏϧυ͢Δ
    (PPHMFݕࡧʮ1)14PVSDF$PEFʯ

    View full-size slide

  16. QIQTSDΛϏϧυ͢Δ
    1)1ͷϥϯλΠϜ QIQTSD
    ͸(JU)VCʹ͋Δ
    IUUQTHJUIVCDPNQIQQIQTSD

    View full-size slide

  17. QIQTSDΛϏϧυ͢Δ
    3&"%.&Λ΋ͱʹϏϧυͯ͠ΈΔ
    IUUQTHJUIVCDPNQIQQIQTSD

    View full-size slide

  18. QIQTSDΛϏϧυ͢Δ
    ಈ͍ͨʂ

    View full-size slide

  19. ΞδΣϯμ
    wQIQTSDΛϏϧυ͢Δ
    w1)1ͷൺֱԋࢉॲཧͷ࣮૷Λ୳͢
    w1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ ڍಈΛมߋ͢Δ


    View full-size slide

  20. 1)1ͷൺֱԋࢉॲཧ࣮૷Λ୳͢
    ίʔυશମͷߏ੒͕Θ͔͍ͬͯͳ͍ͷͰ
    Ͳ͔͜ΒݟΕ͹͍͍͔Θ͔Βͳ͍

    View full-size slide

  21. 1)1ͷൺֱԋࢉॲཧ࣮૷Λ୳͢
    ·ͨ·ͨ(PPHMFݕࡧ

    View full-size slide

  22. 1)1ͷൺֱԋࢉॲཧ࣮૷Λ୳͢
    ˠͰՃ͑ͨൺֱԋࢉͷมߋͷ3'$ͱͦͷ࣮૷Λݟ͚ͭͨ
    IUUQTXJLJQIQOFUSGDTUSJOH@UP@OVNCFS@DPNQBSJTPO

    View full-size slide

  23. 1)1ͷൺֱԋࢉॲཧ࣮૷Λ୳͢
    ;FOE[FOE@PQFSBUPSTDͷ[FOE@DPNQBSF
    ˞

    IUUQTHJUIVCDPNQIQQIQTSDQVMM
    fi
    MFTEJ
    ff
    CFC
    ff
    FCBGFCBDEDGEGDBGDBEFF
    ˞
    1)1ͷίʔυͰ͸ಉ౳ͷؔ਺ͷ໊લ͸DPNQBSF@GVODUJPO


    View full-size slide

  24. ΞδΣϯμ
    wQIQTSDΛϏϧυ͢Δ
    w1)1ͷൺֱԋࢉॲཧͷ࣮૷Λ୳͢
    w1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ ڍಈΛมߋ͢Δ


    View full-size slide

  25. 1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ
    DPNQBSF@GVODUJPO
    ͷத਎
    w ԋࢉର৅ͷܕΛൺֱ
    w ܕ͕ಛఆͷύλʔϯʹϚονͨ͠Β
    w ൺֱԋࢉΛͯ݁͠ՌΛSFTVMUʹ୅ೖ
    w ໭Γ஋ͱͯ͠46$$&44Λฦ͢
    w ܕ͕ಛఆͷύλʔϯʹϚον͠ͳ͚Ε͹ɺԿΒ͔
    ͷม׵Λࢪͯ͠ɺվΊͯܕΛൺֱ

    View full-size slide

  26. 1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ
    DPNQBSF@GVODUJPO
    ͷத਎
    w ԋࢉର৅ͷܕΛൺֱ
    w ܕ͕ಛఆͷύλʔϯʹϚονͨ͠Β
    w ൺֱԋࢉΛͯ݁͠ՌΛSFTVMUʹ୅ೖ
    w ໭Γ஋ͱͯ͠46$$&44Λฦ͢
    w ܕ͕ಛఆͷύλʔϯʹϚον͠ͳ͚Ε͹ɺԿΒ͔
    ͷม׵Λࢪͯ͠ɺվΊͯܕΛൺֱ

    View full-size slide

  27. 1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ
    DPNQBSF@GVODUJPO
    ͷத਎
    IUUQTHJUIVCDPNQIQQIQTSDCMPCECFBE
    ff
    CGBDECDBFBGBGE;FOE[FOE@PQFSBUPSTD--

    View full-size slide

  28. 1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ
    DPNQBSF@GVODUJPO
    Λվ଄
    w ܕ͕ಛఆͷύλʔϯʹϚονͨ͠Β
    w ৽͍͠DBTFΛ௥Ճͯ͠ΈΔ
    w ˠຊདྷͱ͸ҧ͏ڍಈʹͳΔ

    View full-size slide

  29. 1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ
    DPNQBSF@GVODUJPO
    Λվ଄
    USVFͱจࣈྻΛൺֱ
    ӈลͷํ͕େ͖͍ͱ͢Δ
    IUUQTHJTUHJUIVCDPNZBNNFSKQBCGGEFFDEEBFEEFGC

    View full-size slide

  30. 1)1ͷൺֱԋࢉॲཧΛյͯ͠ΈΔ
    DPNQBSF@GVODUJPO
    Λվ଄
    յͤͨʂ
    IUUQTHJTUHJUIVCDPNZBNNFSKQBCGGEFFDEEBFEEFGC

    View full-size slide

  31. தࢁܚ༞ ΍Μ·ʔ

    ൺֱԋࢉΛյͯ͠ΈΔ
    1)15FDI$BGF1)1FSͷͨΊͷʮ1)1ΧϯϑΝϨϯεʯΛޠΓ߹͏

    View full-size slide

  32. தࢁܚ༞ ΍Μ·ʔ

    ൺֱԋࢉΛյͯ͠ΈΔ
    1)15FDI$BGF1)1FSͷͨΊͷʮ1)1ΧϯϑΝϨϯεʯΛޠΓ߹͏
    յͤͨʂ

    View full-size slide