Skip to content

Commit

Permalink
7.4 compile but broke
Browse files Browse the repository at this point in the history
  • Loading branch information
krakjoe committed Feb 11, 2019
1 parent a41f9db commit 60dec8c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
18 changes: 5 additions & 13 deletions .travis.yml
Expand Up @@ -9,7 +9,7 @@ php:
- 7.1
- 7.2
- 7.3
- nightly
- 7.4

env:
global:
Expand All @@ -26,21 +26,13 @@ env:

matrix:
allow_failures:
- php: nightly
- php: 7.4
env: OPCACHE=0 TEST_PHP_ARGS="$DEF"
- php: nightly
- php: 7.4
env: OPCACHE=1 TEST_PHP_ARGS="$DEF"
- php: nightly
- php: 7.4
env: OPCACHE=0 TEST_PHP_ARGS="$DEF $MEMCHECK"
- php: nightly
env: OPCACHE=0 TEST_PHP_ARGS="$DEF" CONF="enable-inspector-coverage" RULE="inspector-test-coverage-travis"
- php: 7.3
env: OPCACHE=0 TEST_PHP_ARGS="$DEF"
- php: 7.3
env: OPCACHE=1 TEST_PHP_ARGS="$DEF"
- php: 7.3
env: OPCACHE=0 TEST_PHP_ARGS="$DEF $MEMCHECK"
- php: 7.3
- php: 7.4
env: OPCACHE=0 TEST_PHP_ARGS="$DEF" CONF="enable-inspector-coverage" RULE="inspector-test-coverage-travis"

before_install:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -12,6 +12,8 @@ API

The following API is provided:

_Note that, because of restrictions around an extension extending Reflection classes, Inspector classes that extend Reflection do so virtually with a __call interface._

```php
namespace Inspector
{
Expand Down
8 changes: 8 additions & 0 deletions php_inspector.c
Expand Up @@ -271,8 +271,12 @@ static void php_inspector_execute(zend_execute_data *execute_data) {
(EX(opline) - function->opcodes);

#if ZEND_EX_USE_RUN_TIME_CACHE
# if PHP_VERSION_ID >= 70400
EX_LOAD_RUN_TIME_CACHE(map);
# else
if (map->run_time_cache)
EX(run_time_cache) = map->run_time_cache;
# endif
#endif

#if ZEND_EX_USE_LITERALS
Expand Down Expand Up @@ -300,8 +304,12 @@ static void php_inspector_execute(zend_execute_data *execute_data) {
(EX(opline) - map->opcodes);

#if ZEND_EX_USE_RUN_TIME_CACHE
# if PHP_VERSION_ID >= 70400
EX_LOAD_RUN_TIME_CACHE(function);
# else
if (map->run_time_cache)
EX(run_time_cache) = function->run_time_cache;
# endif
#endif

#if ZEND_EX_USE_LITERALS
Expand Down
4 changes: 4 additions & 0 deletions src/break.c
Expand Up @@ -337,7 +337,11 @@ static zend_always_inline zend_bool php_inspector_break_exception_caught(zend_ex
if (!ce) {
ce = zend_fetch_class_by_name(
Z_STR_P(RT_CONSTANT(ops, check->op1)),
# if PHP_VERSION_ID >= 70400
Z_STR_P(RT_CONSTANT(check, check->op1) + 1), ZEND_FETCH_CLASS_NO_AUTOLOAD);
# else
RT_CONSTANT(check, check->op1) + 1, ZEND_FETCH_CLASS_NO_AUTOLOAD);
# endif

CACHE_PTR(check->extended_value &~ ZEND_LAST_CATCH, ce);
}
Expand Down
13 changes: 13 additions & 0 deletions src/map.c
Expand Up @@ -308,7 +308,12 @@ static void php_inspector_map_destruct(zend_op_array *mapped) {
(php_inspector_map_callback_t) php_inspector_map_arginfo_delref);
}

#if PHP_VERSION_ID >= 70400
if (ZEND_MAP_PTR(mapped->run_time_cache))
efree(ZEND_MAP_PTR(mapped->run_time_cache));
#else
efree(mapped->run_time_cache);
#endif
efree(mapped->opcodes);
efree(mapped->refcount);
}
Expand Down Expand Up @@ -391,9 +396,17 @@ static zend_always_inline void php_inspector_map_construct(zend_op_array *mapped
mapped->fn_flags &= ~ ZEND_ACC_CLOSURE;
}

#if PHP_VERSION_ID >= 70400
{
void *rtc = ecalloc(1, mapped->cache_size);

ZEND_MAP_PTR_INIT(mapped->run_time_cache, rtc);
}
#else
mapped->run_time_cache = emalloc(mapped->cache_size);

memset(mapped->run_time_cache, 0, mapped->cache_size);
#endif

zend_hash_index_update_ptr(
&IMG(table), (zend_ulong) IMG(src), IMG(map));
Expand Down
2 changes: 2 additions & 0 deletions src/operand.c
Expand Up @@ -163,6 +163,7 @@ static zend_always_inline zend_bool php_inspector_operand_is_class(php_inspector
}
break;

#if PHP_VERSION_ID < 70400
case ZEND_ADD_INTERFACE:
case ZEND_ADD_TRAIT:
case ZEND_BIND_TRAITS:
Expand All @@ -171,6 +172,7 @@ static zend_always_inline zend_bool php_inspector_operand_is_class(php_inspector
return 1;
}
break;
#endif

case ZEND_DECLARE_INHERITED_CLASS_DELAYED:
case ZEND_INSTANCEOF:
Expand Down

0 comments on commit 60dec8c

Please sign in to comment.