View Issue Details

IDProjectCategoryView StatusLast Update
0001592XdebugUsage problems (Wrong Results)public2019-01-17 12:13
ReportermiksserAssigned Toderick 
PriorityurgentSeverityblockReproducibilityunable to reproduce
Status resolvedResolutionduplicate 
Platformwebasyst frameworkOSubuntuOS Version18.04.1
Product Version2.7.0beta1 
Target VersionFixed in Version 
Summary0001592: Removes the default constant ENT_QUOTES
DescriptionUnder uncertain conditions, the value of the ENT_QUOTES constant disappears. What does the warning "PHP Warning: htmlentities() expects parameter 2 to be int". Turning off Xdebug helped fix the situation. For those who did not have xDebug, this problem was not reproduced.
Steps To ReproduceWe could not reproduce this in CLI. But we randomly had a mistake in the sandbox of the framework. We ran this code:

class R
{
    public static function escape($string, $quote_style = ENT_QUOTES)
    {
        return htmlentities((string)$string, $quote_style, 'utf-8');
    }
}

$arr = ['key' => rand(1, 20000)];

for ($i = 0; $i < 1000000; $i++) {
    $b = R::escape($arr['key']);

};

echo $b;


Additional InformationWe also reduced the allocated memory to two megabytes. So the error appeared more often.
TagsNo tags attached.
Operating System
PHP Version7.3-dev

Relationships

duplicate of 0001583 closedderick Xdebug crashes when OPcache's compact literals optimisation is on 

Activities

miksser

2018-12-10 12:38

reporter  

derick

2018-12-11 11:00

administrator   ~0004759

I can't quite reproduce your problem, but I *do* see a problem on the CLI with both opcache and xdebug loaded and running the script through valgrind:

valgrind php -n  -dzend_extension=xdebug.so -dzend_extension=opcache.so -dopcache.enable_cli=1 1592.php


==23800== Memcheck, a memory error detector
==23800== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==23800== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==23800== Command: php -n -dzend_extension=xdebug.so -dzend_extension=opcache.so -dopcache.enable_cli=1 1592.php
==23800== 
==23800== Conditional jump or move depends on uninitialised value(s)
==23800==    at 0x9FEACD: ZEND_RECV_INIT_SPEC_CONST_HANDLER (zend_vm_execute.h:2229)
==23800==    by 0x9FDA67: ZEND_USER_OPCODE_SPEC_HANDLER (zend_vm_execute.h:1829)
==23800==    by 0xA62805: execute_ex (zend_vm_execute.h:55510)
==23800==    by 0x86C15CA: xdebug_execute_ex (xdebug.c:1868)
==23800==    by 0x9FB64C: ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:1083)
==23800==    by 0x9FDA67: ZEND_USER_OPCODE_SPEC_HANDLER (zend_vm_execute.h:1829)
==23800==    by 0xA62805: execute_ex (zend_vm_execute.h:55510)
==23800==    by 0x86C15CA: xdebug_execute_ex (xdebug.c:1868)
==23800==    by 0xA67D16: zend_execute (zend_vm_execute.h:60834)
==23800==    by 0x997069: zend_execute_scripts (zend.c:1568)
==23800==    by 0x906D4D: php_execute_script (main.c:2630)
==23800==    by 0xA6A79E: do_cli (php_cli.c:997)
==23800== 


<code>ZEND_RECV_INIT_SPEC_CONST_HANDLER</code> is responsible for accepting variables into functions, so this might well be this problem. I don't know *why* this happens yet though.

derick

2019-01-17 12:13

administrator   ~0004818

This is like the same issue as 0001583, which has a workaround described: https://bugs.xdebug.org/view.php?id=1583#c4774

Issue History

Date Modified Username Field Change
2018-12-10 12:38 miksser New Issue
2018-12-10 12:38 miksser File Added: photo_2018-12-10_15-37-05.jpg
2018-12-11 11:00 derick Note Added: 0004759
2018-12-11 11:00 derick Assigned To => derick
2018-12-11 11:00 derick Status new => acknowledged
2019-01-17 12:13 derick Note Added: 0004818
2019-01-17 12:13 derick Relationship added duplicate of 0001583
2019-01-17 12:13 derick Status acknowledged => resolved
2019-01-17 12:13 derick Resolution open => duplicate