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

5 Smashing Changes Your Extension Will Encounter #phpblt

2d8205dc9c77318497ef33ba475817fe?s=47 Rize MISUMI
November 24, 2015

5 Smashing Changes Your Extension Will Encounter #phpblt

at PHP BLT (11/24)

2d8205dc9c77318497ef33ba475817fe?s=128

Rize MISUMI

November 24, 2015
Tweet

More Decks by Rize MISUMI

Other Decks in Programming

Transcript

  1. 5 Smashing Changes Your Extension Will Encounter at PHP7 PHP

    BLT #1 / @Misumi_Rize
  2. var_dump($me); → Twitter @Misumi_Rize → GitHub @MisumiRize

  3. Today I talk about...

  4. phpize ./configure make make install

  5. Upgrading extensions for PHP7

  6. gophp7-ext Extensions Catalog https://github.com/gophp7/gophp7-ext/wiki/ extensions-catalog

  7. None
  8. None
  9. How can I upgrade my extension?

  10. Upgrading PHP extensions from PHP5 to NG https://wiki.php.net/phpng-upgrading

  11. First of all: 75% of code will change

  12. Create another branch

  13. php-memcached "php7" branch https://github.com/php-memcached-dev/php- memcached/tree/php7

  14. Note When installing extesions from GitHub, pickle is suitable https://github.com/FriendsOfPHP/pickle

    ./bin/pickle install https://github.com/php-memcached-dev/php-memcached.git#php7
  15. 5 Smashing Changes

  16. 1. zval

  17. zval → zval** Z_*_PP() is obsolete → Change to use

    zval* → PHP7 frequently uses zval directly → ALLOC_ZVAL, ALLOC_INIT_ZVAL, MAKE_STD_ZVAL has removed
  18. 2. char* at PHP

  19. zend_string → Replacement of char* and int length → Many

    of PHP's API using char* has replaced to zend_string
  20. 3. smart_str

  21. smart_string → smart_str is only renamed to smart_string → Struct's

    member is also renamed
  22. 4. HashTable

  23. HashTable → Most API returns values, not SUCCESS, FAILURE →

    char*, length based API (similar to PHP5) remains → But length is changed to exclude trailing zero
  24. 5. Objects

  25. None
  26. Conclusion → There's no best practice to upgrade extension now

    → Reading core extensions will help
  27. Addition: interesting thing I've found #if (PHP_MAJOR_VERSION >= 6)