summaryrefslogtreecommitdiff
path: root/ext/readline/readline_cli.c
Commit message (Collapse)AuthorAgeFilesLines
* Improve handling of `#[` attributes in `php -a`Tyson Andre2020-09-061-0/+4
| | | | | | | | | | | | | | | | | | | | | `php -a` treats lines starting with `#` as comments when deciding if the provided statement is valid. So it passed `#[MyAttr]` to the parser after the user hits enter, causing a syntax error for multi-line statements.. With this patch, the following snippet is parsed correctly ``` php > #[Attr] php > function x() { } php > var_export((new ReflectionFunction('x'))->getAttributes()[0]->getName()); 'Attr' ``` Followup to GH-6085 Closes GH-6086
* Improve handling of `#[` in `php -a`Tyson Andre2020-09-051-2/+2
| | | | | | | | | | | | | | | | | | PHP treats `#ini_setting=value` as a call to `ini_set('ini_setting', 'value')`, and silently skips undeclared settings. This is a problem due to `#[` becoming supported attribute syntax: - `#[Attr] const X = 123;` (this is not a valid place to put an attribute) This does not create a constant. - `#[Attr] function test($x=false){}` also contains `=`. This does not create a function. Instead, only treat lines starting with `#` as a special case when the next character isn't `[` Closes GH-6085
* Allow overriding completion in `auto_prepend_file`Tyson Andre2020-08-011-1/+8
| | | | | | | | | | | | | | | | | | | Currently, it's possible to override `php -a`s completion functionality to provide an alternative to the C implementation, with `readline_completion_function()`. However, that surprisingly gets overridden when called from `auto_prepend_file`, because those scripts get run before the interactive shell is started. I believe that not overriding it would be more consistent with what happens when you override the completion function **after** the interactive shell. CLI is the only built-in API that uses this (See discussion in GH-5872). I believe MINIT and RINIT will only run once when invoked with `php -a`. Add documentation about the architecture of how php uses readline/libedit Closes GH-5872
* Code tweaks: Remove unneeded semicolonsAlex Dowad2020-04-291-1/+1
|
* Remove mention of PHP major version in Copyright headersGabriel Caruso2019-09-251-2/+0
| | | | Closes GH-4732.
* Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-08-231-4/+7
|\ | | | | | | | | * PHP-7.3: Fix #77812: Interactive mode does not support PHP 7.3-style heredoc
| * Fix #77812: Interactive mode does not support PHP 7.3-style heredocChristoph M. Becker2019-08-231-4/+7
| | | | | | | | | | | | | | | | | | As of PHP 7.3.0, the rules regarding the heredoc and nowdoc closing identifier have been relaxed. While formerly, the closing identifier was required to be placed at the beginning of a line and to be immediately followed by (a semicolon and) a line break, it may now be preceeded by whitespace, and may be followed by any non-word character. We adjust the recognition logic respectively.
* | Introduce zend_stream_init_filename()Nikita Popov2019-07-161-10/+2
| | | | | | | | Avoid more ad-hoc initialization of zend_file_handle structures.
* | Avoid potentially-uninitialized warnings in readlineNikita Popov2019-04-121-5/+4
| |
* | Fix uninitializde heredoc_tag use in readlineNikita Popov2019-04-121-3/+10
| | | | | | | | Could happen if "<<<" is directly followed by a newline.
* | Remove checks for locale.h, setlocale, localeconvPeter Kokot2019-04-071-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `<loccale.h>` header file, setlocale, and localeconv are part of the standard C89 [1] and on current systems can be used unconditionally. Since PHP 7.4 requires at least C89 or greater, the `HAVE_LOCALE_H`, `HAVE_SETLOCALE`, and `HAVE_LOCALECONV` symbols defined by Autoconf in configure.ac [2] can be ommitted and simplifed. The bundled libmagic (file) has also been patched already in version 5.35 and up in upstream location so when it will be patched also in php-src the check for locale.h header is still left in the configure.ac and in windows headers definition file. [1] https://port70.net/~nsz/c/c89/c89-draft.html#4.4 [2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4 Omit the bundled libmagic files
* | Remove local variablesPeter Kokot2019-02-031-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the so called local variables defined per file basis for certain editors to properly show tab width, and similar settings. These are mainly used by Vim and Emacs editors yet with recent changes the once working definitions don't work anymore in Vim without custom plugins or additional configuration. Neither are these settings synced across the PHP code base. A simpler and better approach is EditorConfig and fixing code using some code style fixing tools in the future instead. This patch also removes the so called modelines for Vim. Modelines allow Vim editor specifically to set some editor configuration such as syntax highlighting, indentation style and tab width to be set in the first line or the last 5 lines per file basis. Since the php test files have syntax highlighting already set in most editors properly and EditorConfig takes care of the indentation settings, this patch removes these as well for the Vim 6.0 and newer versions. With the removal of local variables for certain editors such as Emacs and Vim, the footer is also probably not needed anymore when creating extensions using ext_skel.php script. Additionally, Vim modelines for setting php syntax and some editor settings has been removed from some *.phpt files. All these are mostly not relevant for phpt files neither work properly in the middle of the file.
* | Remove yearly range from copyright noticeZeev Suraski2019-01-301-1/+1
|/
* Remove unused Git attributes identPeter Kokot2018-07-251-2/+0
| | | | | | | | | | | | | | | The $Id$ keywords were used in Subversion where they can be substituted with filename, last revision number change, last changed date, and last user who changed it. In Git this functionality is different and can be done with Git attribute ident. These need to be defined manually for each file in the .gitattributes file and are afterwards replaced with 40-character hexadecimal blob object name which is based only on the particular file contents. This patch simplifies handling of $Id$ keywords by removing them since they are not used anymore.
* Move to size_t for string lengthAnatol Belski2018-07-091-12/+12
|
* Use zend_string_release_ex() instread of zend_string_release() in places, ↵Dmitry Stogov2018-05-281-6/+6
| | | | where we sure about string persistence.
* year++Xinchen Hui2018-01-021-1/+1
|
* Update copyright headers to 2017Sammy Kaye Powers2017-01-021-1/+1
|
* Fixed compilation warningsDmitry Stogov2016-06-221-1/+2
|
* Merge branch 'PHP-7.0'Joe Watkins2016-04-291-1/+2
|\ | | | | | | | | * PHP-7.0: fix size_t signed comparison
| * fix size_t signed comparisonJoe Watkins2016-04-291-1/+2
| |
* | add wineditline info to minfoAnatol Belski2016-01-151-1/+3
| |
* | basic support for wineditlineAnatol Belski2016-01-151-1/+30
|/
* Merge branch 'PHP-5.6' into PHP-7.0Anatol Belski2016-01-151-0/+4
|\ | | | | | | | | * PHP-5.6: Fix header file include
| * Fix header file includeJason Young2016-01-151-0/+4
| |
* | Merge branch 'PHP-5.6' into PHP-7.0Lior Kaplan2016-01-011-1/+1
|\ \ | |/ | | | | | | * PHP-5.6: Happy new year (Update copyright to 2016)
| * Happy new year (Update copyright to 2016)Lior Kaplan2016-01-011-1/+1
| |
| * bump yearXinchen Hui2015-01-151-1/+1
| |
* | Various warning fixesNikita Popov2015-07-171-1/+1
| |
* | Use ZSTR_ API to access zend_string elements (this is just renaming without ↵Dmitry Stogov2015-06-301-7/+7
| | | | | | | | semantick changes).
* | Drop zend_indent() as it was never used, complete or workingKalle Sommer Nielsen2015-03-271-1/+0
| |
* | Merged zend_array and HashTable into the single data structure.Dmitry Stogov2015-02-131-1/+1
| | | | | | | | | | Now each HashTable is also zend_array, so it's refcounted and may be a subject for Copy on Write zend_array_dup() was changed to allocate and return HashTable, instead of taking preallocated HashTable as argument.
* | bump yearXinchen Hui2015-01-151-1/+1
| |
* | trailing whitespace removalStanislav Malyshev2015-01-101-8/+8
| |
* | Drop duplicate arg from hash_get_current_key_exNikita Popov2014-12-261-1/+1
| |
* | first shot remove TSRMLS_* thingsAnatol Belski2014-12-131-41/+40
| |
* | bring back all the TSRMLS_FETCH() stuffAnatol Belski2014-10-151-0/+1
| | | | | | | | for better comparability with the mainstream
* | Merge remote-tracking branch 'origin/master' into native-tlsAnatol Belski2014-10-061-7/+0
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/master: (42 commits) Add tests verifying calls work inside echo, concatenation and array access Updated NEWS and UPGRADING Fix $this CV init for include/eval Fix dynamic calls to static methods with fci->object Fix $arr =& $arr[0] Add UPGRADING stubs for a number of recent changes Regenerate tokenizer data Fix unused variable warning Remove <% and <script language="php"> tags zend_uint -> uint32_t Fix nesting for *non*-compile-time-resolveable functions See https://github.com/thekid/php-src/commit/a1a4ba95117cca77b6a669d01b1cf97ea4fcb507#commitcomment-7414223 Add tests for calls to nested, *non*-compile-time-resolveable functions See https://github.com/thekid/php-src/commit/a1a4ba95117cca77b6a669d01b1cf97ea4fcb507#commitcomment-7414362 Make list of opcodes used for nesting calculation consistent with `zend_do_convert_call_user_func()` in Zend/zend_compile.c Rewrite code to use ZEND_VM_JMP() instead of repeated ZEND_VM_INC_OPCODE() calls QA: Simplify code to find matching ZEND_DO_FCALL_BY_NAME CG(context).nested_calls is stored inside the initializer's result.num and inside the finalizer's op2.num, by comparing these we don't need to count manually, and are thus safer from future expansion with specialized opcodes e.g. Fix expected fatal error, now is catchable fatal Adjust expected fatal error message Now also includes "on [TYPE]" after merge from master Check for memory leaks when not using return value Adjust expected fatal error message Now also includes "on [TYPE]" after merge from master Add tests with arrays as parameters ...
| * | Remove <% and <script language="php"> tagsNikita Popov2014-10-051-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per https://wiki.php.net/rfc/remove_alternative_php_tags. Removes: * <% opening tag * %> closing tag * <%= short opening tag * /<script\s+language\s*=\s*(php|"php"|'php')\s*>/i opening tag * /</script>/i closing tag * asp_tags ini directive
* | | remove fetches in readlinekrakjoe2014-09-271-1/+0
|/ /
* | Move smart_str implementation into Zend/Nikita Popov2014-09-211-1/+1
| | | | | | | | | | | | | | | | So we can use it there as well... For now I've retained the zend_smart_str_public.h header, though it would probably be better to just move that one struct into zend_types.h.
* | s/PHP 5/PHP 7/Johannes Schlüter2014-09-191-1/+1
| |
* | Fix readline warningsNikita Popov2014-09-051-2/+2
| |
* | Refactored INI subsystem to use zend_string* instead of char*Dmitry Stogov2014-09-011-2/+2
| |
* | Use global symbol table for completion after $ in readline.Johannes Schlüter2014-08-301-1/+1
| |
* | master renames phase 1Anatol Belski2014-08-251-8/+8
| |
* | Merge branch 'master' into phpngDmitry Stogov2014-08-041-2/+15
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (46 commits) PHP_INT_MIN and _MAX tests NEWS and UPGRADING Added PHP_INT_MIN Fix wrong lenght size Bug #51096 - Remove unnecessary ? for first/last day of Moved streams related functions to xp_ssl.c Remove duplicate NEWS Update NEWS Update NEWS Update NEWS BFN BFN Fixed bug #67715 (php-milter does not build and crashes randomly). We need to turn off any strict mode here for this warning to show up Disable restrictions regarding arrays in constants at run-time. For the discussion around it, see the thread on the mailing list: http://www.mail-archive.com/internals@lists.php.net/msg68245.html Revert "Fix bug #67064 in a BC safe way" Updated NEWS for #67693 Updated NEWS for #67693 Fixed bug #67693 - incorrect push to the empty array add missing entry to NEWS ... Conflicts: Zend/tests/errmsg_040.phpt Zend/tests/ns_059.phpt Zend/zend_language_parser.y Zend/zend_vm_def.h ext/openssl/openssl.c ext/reflection/php_reflection.c ext/session/session.c ext/spl/spl_directory.c ext/spl/spl_iterators.c ext/sqlite3/sqlite3.c ext/standard/array.c
| * Fix bug #67496 Save command history when exiting interactive shell with ↵Dmitry Saprykin2014-07-241-1/+11
| | | | | | | | control-c
| * Fix bug #55496 Interactive mode doesn't force a newline before the promptJohannes Schlüter2014-07-241-1/+4
| |
| * Bump yearXinchen Hui2014-01-031-1/+1
| |