mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Add string output escaping into zend dump (phpdbg + opcache debug) (#11337)
* Add string output escaping into zend dump (phpdbg + opcache debug) * Use ZSTR_VAL macro instead direct string access * Move "escaped_string" into local switch/case scope * Add zend_string_release * Add Z_STR_P macro instead direct string access * Merge zend_string declaration and its assigment in one stmt
This commit is contained in:
parent
99ec0c1acf
commit
b495a916a4
2 changed files with 11 additions and 6 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "zend_func_info.h"
|
||||
#include "zend_call_graph.h"
|
||||
#include "zend_dump.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
|
||||
void zend_dump_ht(HashTable *ht)
|
||||
{
|
||||
|
@ -65,8 +66,12 @@ void zend_dump_const(const zval *zv)
|
|||
case IS_DOUBLE:
|
||||
fprintf(stderr, " float(%g)", Z_DVAL_P(zv));
|
||||
break;
|
||||
case IS_STRING:
|
||||
fprintf(stderr, " string(\"%s\")", Z_STRVAL_P(zv));
|
||||
case IS_STRING:;
|
||||
zend_string *escaped_string = php_addcslashes(Z_STR_P(zv), "\"\\", 2);
|
||||
|
||||
fprintf(stderr, " string(\"%s\")", ZSTR_VAL(escaped_string));
|
||||
|
||||
zend_string_release(escaped_string);
|
||||
break;
|
||||
case IS_ARRAY:
|
||||
fprintf(stderr, " array(...)");
|
||||
|
|
|
@ -29,7 +29,7 @@ Foo\Bar::Foo:
|
|||
; (lines=5, args=1, vars=1, tmps=1)
|
||||
; %s:5-7
|
||||
L0005 0000 CV0($bar) = RECV 1
|
||||
L0006 0001 INIT_NS_FCALL_BY_NAME 1 string("Foo\var_dump")
|
||||
L0006 0001 INIT_NS_FCALL_BY_NAME 1 string("Foo\\var_dump")
|
||||
L0006 0002 SEND_VAR_EX CV0($bar) 1
|
||||
L0006 0003 DO_FCALL
|
||||
L0007 0004 RETURN null
|
||||
|
@ -44,10 +44,10 @@ prompt> [Context %s (9 ops)]
|
|||
$_main:
|
||||
; (lines=9, args=0, vars=0, tmps=4)
|
||||
; %s:1-21
|
||||
L0018 0000 V0 = NEW 0 string("Foo\Bar")
|
||||
L0018 0000 V0 = NEW 0 string("Foo\\Bar")
|
||||
L0018 0001 DO_FCALL
|
||||
L0018 0002 INIT_METHOD_CALL 1 V0 string("Foo")
|
||||
L0018 0003 SEND_VAL_EX string("test") 1
|
||||
L0018 0003 SEND_VAL_EX string("test \"quotes\"") 1
|
||||
L0018 0004 DO_FCALL
|
||||
L0019 0005 INIT_FCALL %d %d string("foo")
|
||||
L0019 0006 SEND_VAL string("test") 1
|
||||
|
@ -72,6 +72,6 @@ namespace {
|
|||
var_dump(strrev($baz));
|
||||
}
|
||||
|
||||
(new \Foo\Bar)->Foo("test");
|
||||
(new \Foo\Bar)->Foo('test "quotes"');
|
||||
foo("test");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue