Skip to content

Commit 81b9b7a

Browse files
committed
Fix PHP 7.0 build
1 parent 26bf9d3 commit 81b9b7a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
sudo: false
12
language: php
23

34
php:
45
- 7.0
6+
- nightly
57

68
before_script:
79
- phpize

ast.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,16 @@ static void ast_to_zval(zval *zv, zend_ast *ast, zend_long version) {
345345
}
346346

347347
/* Convert doc comments on properties and constants into properties */
348-
if ((version >= 15 && ast->kind == ZEND_AST_PROP_ELEM && ast->child[2])
349-
|| (ast->kind == ZEND_AST_CONST_ELEM && ast->child[2])) {
348+
if (version >= 15 && ast->kind == ZEND_AST_PROP_ELEM && ast->child[2]) {
350349
ZVAL_STR_COPY(&tmp_zv, zend_ast_get_str(ast->child[2]));
351350
ast_update_property(zv, AST_STR(str_docComment), &tmp_zv, NULL);
352351
}
352+
#if PHP_VERSION_ID >= 70100
353+
if (ast->kind == ZEND_AST_CONST_ELEM && ast->child[2]) {
354+
ZVAL_STR_COPY(&tmp_zv, zend_ast_get_str(ast->child[2]));
355+
ast_update_property(zv, AST_STR(str_docComment), &tmp_zv, NULL);
356+
}
357+
#endif
353358

354359
array_init(&tmp_zv);
355360
ast_update_property(zv, AST_STR(str_children), &tmp_zv, AST_CACHE_SLOT_CHILDREN);

0 commit comments

Comments
 (0)