View Issue Details

IDProjectCategoryView StatusLast Update
0001615XdebugStep Debuggingpublic2020-03-12 16:43
Reporterderick Assigned Toderick  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Fixed in Version2.7.2 
Summary0001615: Turn off Zend OPcache when remote debugger is turned On.
Description

When Zend OPcache optimises code, it makes single step debugging less useful, as certain things are disabled. This already caused reports such as 0001609. In order to improve this, Xdebug should turn off OPcache, or maybe only its optimisations, with a patch like in https://gist.github.com/krakjoe/2ceda9c736a017c20359ca44f66861af (also attached), created by Joe Watkins.

TagsNo tags attached.
Attached Files
dfa.diff (968 bytes)   
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);
dfa.diff (968 bytes)   
Operating System
PHP Version7.3.0-7.3.1

Activities

Issue History

Date Modified Username Field Change
2019-01-31 19:23 derick New Issue
2019-01-31 19:23 derick File Added: dfa.diff
2019-02-01 15:25 derick Assigned To => derick
2019-02-01 15:25 derick Status new => acknowledged
2019-04-12 15:12 derick Status acknowledged => assigned
2019-04-12 15:12 derick Target Version 3.0dev => 2.7.0dev
2019-04-13 08:26 derick Status assigned => closed
2019-04-13 08:26 derick Resolution open => fixed
2019-04-13 08:26 derick Fixed in Version => 2.7.0dev
2019-05-06 15:46 derick Fixed in Version 2.7.0dev => 2.7.2
2020-03-12 16:43 derick Category Feature/Change request => Step Debugging