jbboehr / php-mustache

Mustache PHP Extension
MIT License
56 stars 22 forks source link

fix for PHP 7.3 and Array/Object recursion protection #48

Closed remicollet closed 6 years ago

remicollet commented 6 years ago

From UPGRADING.INTERNALS

  c. Protection from recursion during processing circular data structures was
     refactored. HashTable.nApplyCount and IS_OBJ_APPLY_COUNT are replaced by
     single flag GC_PROTECTED. Corresponding macros Z_OBJ_APPLY_COUNT,
     Z_OBJ_INC_APPLY_COUNT, Z_OBJ_DEC_APPLY_COUNT, ZEND_HASH_GET_APPLY_COUNT,
     ZEND_HASH_INC_APPLY_COUNT, ZEND_HASH_DEC_APPLY_COUNT are replaced with
     GC_IS_RECURSIVE, GC_PROTECT_RECURSION, GC_UNPROTECT_RECURSION,
     Z_IS_RECURSIVE, Z_PROTECT_RECURSION, Z_UNPROTECT_RECURSION.

     HASH_FLAG_APPLY_PROTECTION flag and ZEND_HASH_APPLY_PROTECTION() macro
     are removed. All mutable arrays should use recursion protection.
     Corresponding checks should be replaced by Z_REFCOUNTED() or
     !(GC_GLAGS(p) & GC_IMMUTABLE).
remicollet commented 6 years ago

WIth this change:

=====================================================================
PHP         : /opt/remi/php73/root/usr/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 7.3.0alpha2
ZEND_VERSION: 3.3.0-dev
PHP_OS      : Linux - Linux builder.remirepo.net 4.16.16-200.fc27.x86_64 #1 SMP Sun Jun 17 03:06:00 UTC 2018 x86_64
INI actual  : /work/GIT/php-mustache/tmp-php.ini
More .INIs  :   
CWD         : /work/GIT/php-mustache
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2018-06-28 06:45:53
=====================================================================
PASS MustacheAST::__construct() member function [tests/MustacheAST____construct.phpt] 
....
PASS Section [tests/mustache-spec-~lambdas-section.phpt] 
=====================================================================
TIME END 2018-06-28 06:45:57

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   15
---------------------------------------------------------------------

Number of tests :  191               186
Tests skipped   :    5 (  2.6%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :  186 ( 97.4%) (100.0%)
---------------------------------------------------------------------
Time taken      :    4 seconds
=====================================================================
coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 89.295% when pulling a6b22a380212ff2db890587669088d241d4e65bc on remicollet:issue-php73 into 7b398cad8b56ca608978947e4548f9a9480113dc on jbboehr:master.

jbboehr commented 6 years ago

Thanks!