diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-15 16:26:25 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-15 16:26:25 +0200 |
commit | 9207aef60c1449ecaec05f83836ab7bd903d62e8 (patch) | |
tree | 810dcc29be9c931100c173192d01bdc3d9ead453 /sapi/phpdbg/phpdbg_prompt.c | |
parent | e33d7dc9e61c549e2c6a3bcb70401eed2af9390f (diff) | |
parent | c5f1b384b591009310370f0b06b10868d2d62741 (diff) | |
download | php-git-9207aef60c1449ecaec05f83836ab7bd903d62e8.tar.gz |
Merge branch 'PHP-7.4'
Diffstat (limited to 'sapi/phpdbg/phpdbg_prompt.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_prompt.c | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 801f4fbb8f..6381ce51fb 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -567,10 +567,7 @@ int phpdbg_compile(void) /* {{{ */ { zend_file_handle fh; char *buf; - char *start_line = NULL; size_t len; - size_t start_line_len; - int i; if (!PHPDBG_G(exec)) { phpdbg_error("inactive", "type=\"nocontext\"", "No execution context"); @@ -578,51 +575,9 @@ int phpdbg_compile(void) /* {{{ */ } if (php_stream_open_for_zend_ex(PHPDBG_G(exec), &fh, USE_PATH|STREAM_OPEN_FOR_INCLUDE) == SUCCESS && zend_stream_fixup(&fh, &buf, &len) == SUCCESS) { - /* Skip #! line */ - if (len >= 3 && buf[0] == '#' && buf[1] == '!') { - char *end = buf + len; - do { - switch (fh.handle.stream.mmap.buf++[0]) { - case '\r': - if (fh.handle.stream.mmap.buf[0] == '\n') { - fh.handle.stream.mmap.buf++; - } - case '\n': - CG(start_lineno) = 2; - start_line_len = fh.handle.stream.mmap.buf - buf; - start_line = emalloc(start_line_len); - memcpy(start_line, buf, start_line_len); - fh.handle.stream.mmap.len -= start_line_len; - end = fh.handle.stream.mmap.buf; - } - } while (fh.handle.stream.mmap.buf + 1 < end); - } - + CG(skip_shebang) = 1; PHPDBG_G(ops) = zend_compile_file(&fh, ZEND_INCLUDE); - /* prepend shebang line to file_source */ - if (start_line) { - phpdbg_file_source *data = zend_hash_find_ptr(&PHPDBG_G(file_sources), PHPDBG_G(ops)->filename); - - dtor_func_t dtor = PHPDBG_G(file_sources).pDestructor; - PHPDBG_G(file_sources).pDestructor = NULL; - zend_hash_del(&PHPDBG_G(file_sources), PHPDBG_G(ops)->filename); - PHPDBG_G(file_sources).pDestructor = dtor; - - data = erealloc(data, sizeof(phpdbg_file_source) + sizeof(uint32_t) * ++data->lines); - memmove(data->line + 1, data->line, sizeof(uint32_t) * data->lines); - data->line[0] = 0; - data->buf = erealloc(data->buf, data->len + start_line_len); - memmove(data->buf + start_line_len, data->buf, data->len); - memcpy(data->buf, start_line, start_line_len); - efree(start_line); - data->len += start_line_len; - for (i = 1; i <= data->lines; i++) { - data->line[i] += start_line_len; - } - zend_hash_update_ptr(&PHPDBG_G(file_sources), PHPDBG_G(ops)->filename, data); - } - fh.handle.stream.mmap.buf = buf; fh.handle.stream.mmap.len = len; zend_destroy_file_handle(&fh); |