Skip to content

Commit

Permalink
Merge 39cf30e into d82345e
Browse files Browse the repository at this point in the history
  • Loading branch information
jbboehr committed Nov 13, 2020
2 parents d82345e + 39cf30e commit 68a239b
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- "7.2"
- "7.3"
- "7.4"
# - "8.0-rc"
- "8.0-rc"
DOCKER_NAME:
- "alpine"
- "debian"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- "7.2"
- "7.3"
- "7.4"
# - "8.0"
- "8.0"
COVERAGE: ["true", "false"]
steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:
strategy:
fail-fast: false
matrix:
PHP_VERSION: ["7.2", "7.3", "7.4"]
PHP_VERSION:
- "7.2"
- "7.3"
- "7.4"
steps:
- uses: actions/checkout@v2
- name: I am tired of writing this shit in YAML and learning a new DSL for every CI service so I'm putting everything in a FSCKING BASH SCRIPT
Expand Down
11 changes: 9 additions & 2 deletions mustache_ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,11 @@ PHP_METHOD(MustacheAST, __sleep)
int len = 0;
mustache_node_to_binary_string(payload->node, &str, &len);
if( str != NULL ) {
zend_update_property_stringl(MustacheAST_ce_ptr, _this_zval,
ZEND_STRL("binaryString"), str, len);
#if PHP_VERSION_ID < 80000
zend_update_property_stringl(MustacheAST_ce_ptr, _this_zval, ZEND_STRL("binaryString"), str, len);
#else
zend_update_property_stringl(MustacheAST_ce_ptr, Z_OBJ_P(_this_zval), ZEND_STRL("binaryString"), str, len);
#endif
add_next_index_string(return_value, "binaryString");
efree(str);
}
Expand Down Expand Up @@ -338,7 +341,11 @@ static inline void php_mustache_ast_wakeup(zval * _this_zval, zval * return_valu
{
zval rv;
struct php_obj_MustacheAST * payload = php_mustache_ast_object_fetch_object(_this_zval);
#if PHP_VERSION_ID < 80000
zval * value = zend_read_property(Z_OBJCE_P(_this_zval), _this_zval, "binaryString", sizeof("binaryString")-1, 1, &rv);
#else
zval * value = zend_read_property(Z_OBJCE_P(_this_zval), Z_OBJ_P(_this_zval), "binaryString", sizeof("binaryString")-1, 1, &rv);
#endif

if( Z_TYPE_P(value) == IS_STRING && Z_STRLEN_P(value) > 0 ) {
mustache_node_from_binary_string(&payload->node, Z_STRVAL_P(value), Z_STRLEN_P(value));
Expand Down
2 changes: 1 addition & 1 deletion mustache_class_method_lambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ int ClassMethodLambda::getUserFunctionParamCount()

int ClassMethodLambda::invokeUserFunction(zval *retval_ptr, int param_count, zval params[])
{
return call_user_function_ex(EG(function_table), object, &function_name, retval_ptr, param_count, params, 1, NULL);
return call_user_function(NULL, object, &function_name, retval_ptr, param_count, params);
}
11 changes: 7 additions & 4 deletions mustache_exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ void mustache_exception_handler()
ZVAL_OBJ(&ex, obj);
exception = &ex;

zend_update_property_long(MustacheParserException_ce_ptr, exception,
(char *) "templateLineNo", strlen("templateLineNo"), e.lineNo);
zend_update_property_long(MustacheParserException_ce_ptr, exception,
(char *) "templateCharNo", strlen("templateCharNo"), e.charNo);
#if PHP_VERSION_ID < 80000
zend_update_property_long(MustacheParserException_ce_ptr, exception, (char *) "templateLineNo", strlen("templateLineNo"), e.lineNo);
zend_update_property_long(MustacheParserException_ce_ptr, exception, (char *) "templateCharNo", strlen("templateCharNo"), e.charNo);
#else
zend_update_property_long(MustacheParserException_ce_ptr, Z_OBJ_P(exception), (char *) "templateLineNo", strlen("templateLineNo"), e.lineNo);
zend_update_property_long(MustacheParserException_ce_ptr, Z_OBJ_P(exception), (char *) "templateCharNo", strlen("templateCharNo"), e.charNo);
#endif
} catch( mustache::Exception& e ) {
zend_throw_exception_ex(MustacheException_ce_ptr, 0,
(char *) e.what(), "MustacheException");
Expand Down
8 changes: 8 additions & 0 deletions mustache_mustache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ static inline void mustache_parse_partial_param(char * key, zval * data,
// String key, object value
if( Z_OBJCE_P(data) == MustacheTemplate_ce_ptr ) {
zval rv;
#if PHP_VERSION_ID < 80000
zval * value = zend_read_property(Z_OBJCE_P(data), data, "template", sizeof("template")-1, 1, &rv);
#else
zval * value = zend_read_property(Z_OBJCE_P(data), Z_OBJ_P(data), "template", sizeof("template")-1, 1, &rv);
#endif
convert_to_string(value);
std::string tmpstr(Z_STRVAL_P(value));
ckey.assign(key);
Expand Down Expand Up @@ -276,7 +280,11 @@ bool mustache_parse_template_param(zval * tmpl, mustache::Mustache * mustache,
// Use compiled template
if( Z_OBJCE_P(tmpl) == MustacheTemplate_ce_ptr ) {
zval rv;
#if PHP_VERSION_ID < 80000
zval * value = zend_read_property(Z_OBJCE_P(tmpl), tmpl, "template", sizeof("template")-1, 1, &rv);
#else
zval * value = zend_read_property(Z_OBJCE_P(tmpl), Z_OBJ_P(tmpl), "template", sizeof("template")-1, 1, &rv);
#endif
convert_to_string(value);
std::string tmpstr(Z_STRVAL_P(value));

Expand Down
11 changes: 9 additions & 2 deletions mustache_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ PHP_METHOD(MustacheTemplate, __construct)

// Check if data was null
if( template_len > 0 && template_str != NULL ) {
zend_update_property_stringl(MustacheTemplate_ce_ptr, _this_zval,
"template", sizeof("template") - 1, template_str, template_len);
#if PHP_VERSION_ID < 80000
zend_update_property_stringl(MustacheTemplate_ce_ptr, _this_zval, "template", sizeof("template") - 1, template_str, template_len);
#else
zend_update_property_stringl(MustacheTemplate_ce_ptr, Z_OBJ_P(_this_zval), "template", sizeof("template") - 1, template_str, template_len);
#endif
}

} catch(...) {
Expand All @@ -94,7 +97,11 @@ PHP_METHOD(MustacheTemplate, __toString)

// Return
zval rv;
#if PHP_VERSION_ID < 80000
zval * value = zend_read_property(Z_OBJCE_P(_this_zval), _this_zval, "template", sizeof("template")-1, 1, &rv);
#else
zval * value = zend_read_property(Z_OBJCE_P(_this_zval), Z_OBJ_P(_this_zval), "template", sizeof("template")-1, 1, &rv);
#endif
convert_to_string(value);
RETURN_ZVAL(value, 1, 0);

Expand Down
6 changes: 5 additions & 1 deletion mustache_zend_closure_lambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ ZendClosureLambda::~ZendClosureLambda()

int ZendClosureLambda::getUserFunctionParamCount()
{
#if PHP_VERSION_ID < 80000
const zend_function * func = zend_get_closure_method_def(closure);
#else
const zend_function * func = zend_get_closure_method_def(Z_OBJ_P(closure));
#endif
return func->common.num_args;
}

int ZendClosureLambda::invokeUserFunction(zval *retval_ptr, int param_count, zval params[])
{
return call_user_function_ex(CG(function_table), NULL, closure, retval_ptr, param_count, params, 1, NULL);
return call_user_function(NULL, NULL, closure, retval_ptr, param_count, params);
}

0 comments on commit 68a239b

Please sign in to comment.