Skip to content

Commit

Permalink
Merge branch 'PHP-7.0' into PHP-7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoebi committed Nov 13, 2016
2 parents dbd504e + ba75d4c commit ef65797
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
21 changes: 14 additions & 7 deletions sapi/phpdbg/phpdbg_bp.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "phpdbg_utils.h"
#include "phpdbg_opcode.h"
#include "zend_globals.h"
#include "ext/standard/php_string.h"

ZEND_EXTERN_MODULE_GLOBALS(phpdbg)

Expand Down Expand Up @@ -135,10 +136,12 @@ PHPDBG_API void phpdbg_export_breakpoints_to_string(char **str) /* {{{ */

switch (brake->type) {
case PHPDBG_BREAK_FILE: {
zend_string *filename = php_addcslashes(zend_string_init(((phpdbg_breakfile_t*)brake)->filename, strlen(((phpdbg_breakfile_t*)brake)->filename), 0), 1, "\\\"\n", 3);
phpdbg_asprintf(&new_str,
"%sbreak %s:%lu\n", *str,
((phpdbg_breakfile_t*)brake)->filename,
"%sbreak \"%s\":%lu\n", *str,
ZSTR_VAL(filename),
((phpdbg_breakfile_t*)brake)->line);
zend_string_release(filename);
} break;

case PHPDBG_BREAK_SYM: {
Expand Down Expand Up @@ -170,10 +173,12 @@ PHPDBG_API void phpdbg_export_breakpoints_to_string(char **str) /* {{{ */
} break;

case PHPDBG_BREAK_FILE_OPLINE: {
zend_string *filename = php_addcslashes(zend_string_init(((phpdbg_breakopline_t*)brake)->class_name, strlen(((phpdbg_breakopline_t*)brake)->class_name), 0), 1, "\\\"\n", 3);
phpdbg_asprintf(&new_str,
"%sbreak %s:#%llu\n", *str,
((phpdbg_breakopline_t*)brake)->class_name,
"%sbreak \"%s\":#%llu\n", *str,
filename,
((phpdbg_breakopline_t*)brake)->opline_num);
zend_string_release(filename);
} break;

case PHPDBG_BREAK_OPCODE: {
Expand All @@ -199,12 +204,14 @@ PHPDBG_API void phpdbg_export_breakpoints_to_string(char **str) /* {{{ */
conditional->code);
break;

case FILE_PARAM:
case FILE_PARAM: {
zend_string *filename = php_addcslashes(zend_string_init(conditional->param.file.name, strlen(conditional->param.file.name), 0), 1, "\\\"\n", 3);
phpdbg_asprintf(&new_str,
"%sbreak at %s:%lu if %s\n", *str,
"%sbreak at \"%s\":%lu if %s\n", *str,
conditional->param.file.name, conditional->param.file.line,
conditional->code);
break;
zend_string_release(filename);
} break;

default: { /* do nothing */ } break;
}
Expand Down
2 changes: 1 addition & 1 deletion sapi/phpdbg/phpdbg_lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ int phpdbg_lex (phpdbg_param_t* yylval) {
#line 161 "sapi/phpdbg/phpdbg_lexer.l"
{
phpdbg_init_param(yylval, STR_PARAM);
yylval->str = estrndup(yytext + (*yytext == '\'' || *yytext == '\"'), yyleng - unescape_string(yytext));
yylval->str = estrndup(yytext, yyleng - unescape_string(yytext));
yylval->len = yyleng;
return T_ID;
}
Expand Down
2 changes: 1 addition & 1 deletion sapi/phpdbg/phpdbg_lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ INPUT ("\\"[#"']|["]("\\\\"|"\\"["]|[^\n\000"])+["]|[']("\\"[']|"\\\\"|[^\
<NORMAL>{GENERIC_ID} {
phpdbg_init_param(yylval, STR_PARAM);
yylval->str = estrndup(yytext + (*yytext == '\'' || *yytext == '\"'), yyleng - unescape_string(yytext));
yylval->str = estrndup(yytext, yyleng - unescape_string(yytext));
yylval->len = yyleng;
return T_ID;
}
Expand Down
2 changes: 1 addition & 1 deletion sapi/phpdbg/phpdbg_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */
break;
case IS_STRING: {
int i;
zend_string *str = php_addcslashes(Z_STR_P(zv), 0, "\\\"", 2);
zend_string *str = php_addcslashes(Z_STR_P(zv), 0, "\\\"\n\t\0", 5);
for (i = 0; i < ZSTR_LEN(str); i++) {
if (ZSTR_VAL(str)[i] < 32) {
ZSTR_VAL(str)[i] = ' ';
Expand Down
4 changes: 2 additions & 2 deletions sapi/phpdbg/tests/exceptions_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ prompt> [L0 %s HANDLE_EXCEPTION
>00005: x();
00006: } finally {
00007: print "ok\n";
prompt> [L7 %s ECHO "ok " %s]
prompt> [L7 %s ECHO "ok\n" %s]
>00007: print "ok\n";
00008: }
00009: } catch (Error $e) {
Expand All @@ -30,7 +30,7 @@ prompt> ok
>00005: x();
00006: } finally {
00007: print "ok\n";
prompt> [L10 %s ECHO "caught " %s]
prompt> [L10 %s ECHO "caught\n" %s]
>00010: print "caught\n";
00011: }
00012:
Expand Down
2 changes: 1 addition & 1 deletion sapi/phpdbg/tests/info_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ prompt> string(4) "test"
00017:
prompt> [Variables in foo() (1)]
Address Refs Type Variable
%s 1 string $baz
%s %d string $baz
string (4) "test"
prompt> [Superglobal variables (8)]
Address Refs Type Variable
Expand Down

0 comments on commit ef65797

Please sign in to comment.