Skip to content

Instantly share code, notes, and snippets.

@krakjoe

krakjoe/dfa.diff Secret

Last active January 31, 2019 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krakjoe/2ceda9c736a017c20359ca44f66861af to your computer and use it in GitHub Desktop.
Save krakjoe/2ceda9c736a017c20359ca44f66861af to your computer and use it in GitHub Desktop.
diff --git a/xdebug.c b/xdebug.c
index 7442222f..d937b462 100644
--- a/xdebug.c
+++ b/xdebug.c
@@ -1187,11 +1187,26 @@ static void xdebug_overloaded_functions_restore(TSRMLS_D)
PHP_RINIT_FUNCTION(xdebug)
{
char *idekey;
+ zend_long optimizer;
#if defined(ZTS) && defined(COMPILE_DL_XDEBUG)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
+ if ((optimizer = INI_INT("opcache.optimization_level"))) {
+ zend_string *key = zend_string_init(ZEND_STRL("opcache.optimization_level"), 1);
+ zend_string *value;
+
+ optimizer &= ~(1<<5);
+
+ value = strpprintf(0, "0x%08X", optimizer);
+
+ zend_alter_ini_entry(key, value, ZEND_INI_SYSTEM, ZEND_INI_STAGE_STARTUP);
+
+ zend_string_release(key);
+ zend_string_release(value);
+ }
+
/* Get the ide key for this session */
XG(ide_key) = NULL;
idekey = xdebug_env_key(TSRMLS_C);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment