summaryrefslogtreecommitdiff
path: root/sapi/cli/php_cli.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLIChristoph M. Becker2021-02-221-1/+1
| | | | | | | There is no good reason not to show the credits in text based SAPIs, except for brevity. Thus, we suppress the credits from `php -i`. Closes GH-6710.
* Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-06-011-0/+3
|\ | | | | | | | | * PHP-7.3: Fix #79650: php-win.exe 100% cpu lockup
| * Fix #79650: php-win.exe 100% cpu lockupChristoph M. Becker2020-06-011-0/+3
| | | | | | | | | | | | As of PHP 7.3.0, `sapi_cli_single_write()` is supposed to return `< 0` on failure, but `fwrite()` returns a `size_t`, and signals error by setting the stream's error indicator. We have to cater to that.
* | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-01-271-1/+5
|\ \ | |/ | | | | | | * PHP-7.3: Fix bug #78323: Code 0 is returned on invalid options
| * Fix bug #78323: Code 0 is returned on invalid optionsIvan Mikheykin2020-01-271-1/+5
| | | | | | | | | | Set CLI exit code to 1 when invalid parameters are passed, and print error to stderr.
* | Don't call Reflection::export() in --rf etc implementationNikita Popov2019-08-301-1/+2
| | | | | | | | | | This method is deprecated ... instead simply directly print the object.
* | Fix noalias violation in select callNikita Popov2019-08-231-3/+2
| |
* | Introduce zend_stream_init_fp() APINikita Popov2019-07-161-13/+4
| | | | | | | | | | Reduce the amount of code that mucks around with zend_file_handle initialization.
* | Move shebang handling into the lexerNikita Popov2019-07-151-27/+7
| | | | | | | | | | | | | | | | | | | | Instead of handling shebang lines by adjusting the file pointer in individual SAPIs, move the handling into the lexer, where this is both a lot simpler and more robust. Whether the shebang should be skipped is controlled by CG(skip_shebang) -- we might want to do that in more cases. This fixed bugs #60677 and #78066.
* | fix mac tests on azureJoe Watkins2019-06-141-0/+6
| |
* | 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 HAVE_SIGNAL_HPeter Kokot2019-04-071-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `<signal.h>` header file is part of the standard C89 headers [1] and on current systems can be included unconditionally. Since file requires at least C89 or greater, the `HAVE_SIGNAL_H` symbol defined by Autoconf in Zend.m4 [2] can be ommitted and simplifed. The bundled libmagic (file) also ommits the usage of HAVE_SIGNAL_H since 5.35 however current version in PHP is very modified 5.34 version and will be refactored separately. Check for HAVE_SIGNAL_H is therefore still done in the configure.ac. Refs: [1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2 [2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
* | Implemented a faster way to access predefined TSRM resources - CG(), EG(), etc.Dmitry Stogov2019-03-141-2/+1
| |
* | Avoid reinitailization of ZTS cache pointer. Initialize it once in TSRM.cDmitry Stogov2019-03-121-0/+2
| |
* | Update and fix remaining year ranges (2019)Peter Kokot2019-02-081-1/+1
| | | | | | | | | | | | This patch follows previous license year ranges updates. With new approach source code files now have simplified headers with license information without year ranges.
* | 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
| |
* | Replace zend_hash_apply... with ZEND_HASH_FOREACH...Dmitry Stogov2018-12-191-9/+4
|/
* Merge branch 'PHP-7.2' into PHP-7.3Anatol Belski2018-11-161-5/+4
|\ | | | | | | | | * PHP-7.2: Fixed bug #77111 php-win.exe corrupts unicode symbols from cli parameters
| * Fixed bug #77111 php-win.exe corrupts unicode symbols from cli parametersAnatol Belski2018-11-161-5/+4
| | | | | | | | | | | | The binary can be of course used on console, for whatever reasons, so UNICODE API should be used in that case. That might however not work as expected, if the binary is used for a service.
| * year++Xinchen Hui2018-01-021-2/+2
| |
* | Pack zend_constant.flags and zend_constant.module_number into reserved space ↵Dmitry Stogov2018-07-261-6/+3
| | | | | | | | inside zend_constant.value.
* | 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.
* | Fix bug #44217: Output after stdout/stderr closed cause immediate exit with ↵Robert Lu2018-06-191-15/+6
| | | | | | | | | | | | status 0 We exit with status 255 instead.
* | Fix some misspellingsGabriel Caruso2018-02-061-1/+1
| |
* | year++Xinchen Hui2018-01-021-2/+2
| |
* | Use per-request heap instead of system oneDmitry Stogov2017-10-271-3/+3
|/
* Rework automatic interactive cli activationAnatol Belski2017-08-031-4/+14
| | | | | There are still systems delivering buggy console info. If a file was passed, obviously no interaction is meant.
* Fixed bug #74849 Process is started as interactive shell in PhpStormAnatol Belski2017-07-031-2/+1
|
* Fixed php_socket_t to int conversionRichard Fussenegger2017-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This warning was about a possible loss of data due to the downcast of `php_socket_t` to `int`. The former maps to a platform specific type, hence, it might downcast from a 64 bit integer to a 32 bit intger. Fixed possibly overflowing vars Due to the change from `int` to `php_socket_t` some variables might overflow now. Changed all variables that might be affected. Revert "Fixed possibly overflowing vars" This reverts commit bf64fd5984409a208ef32108990a6085b6556273. Use aliased PHP socket type Using the alias protects us from changes to the underlying type. Removed ignored nfds argument The `nfds` argument to the Win32 `select` function is always ignored, regardless of its actual value. Hence, we should not pass it in the first place. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms740141(v=vs.85).aspx for reference. Target value is not a pointer Avoid overflow in loop
* extend conditionAnatol Belski2017-05-271-1/+1
|
* Turn interactive mode on, if cli binary is clicked in filemanagerAnatol Belski2017-05-251-0/+5
|
* Merge branch 'PHP-7.1'Joe Watkins2017-01-101-1/+1
|\ | | | | | | | | * PHP-7.1: Fixed #73902 mention router support in usage output for php-cli
| * Merge branch 'PHP-7.0' into PHP-7.1Joe Watkins2017-01-101-1/+1
| |\ | | | | | | | | | | | | * PHP-7.0: Fixed #73902 mention router support in usage output for php-cli
| | * Fixed #73902 mention router support in usage output for php-cliJoe Watkins2017-01-101-1/+1
| | |
| | * Update copyright headers to 2017Sammy Kaye Powers2017-01-041-2/+2
| | |
| * | Update copyright headers to 2017Sammy Kaye Powers2017-01-041-2/+2
| | |
* | | Update copyright headers to 2017Sammy Kaye Powers2017-01-021-2/+2
| | |
* | | Merge branch 'PHP-7.1'Nikita Popov2017-01-011-0/+3
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.0' into PHP-7.1Nikita Popov2017-01-011-0/+3
| |\ \ | | |/
| | * Flush stderr on win32 in cli_log_messageNikita Popov2017-01-011-0/+3
| | | | | | | | | | | | This allows us to unfork a bunch of tests for Windows.
* | | Path handling related refactoringsAnatol Belski2016-12-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Primarily related to the path handling datatypes, to avoid unnecessary casts, where possible. Also some rework to avoid code dup. Probably more places are to go, even not path related, primarily to have less casts and unsigned integers where possible. That way, we've not only less warnings and casts, but are also safer with regard to the integer overflows. OFC it's not a panacea, but still significantly reduces the vulnerability potential.
* | | Use "Standard input code" instead of "php://stdin"Andrea Faulds2016-11-121-2/+2
| | |
* | | Show "php://stdin" instead of "-" in error messagesAndrea Faulds2016-11-121-2/+2
| | |
* | | Add VT100 support for WindowsMichele Locati2016-10-281-0/+9
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix function names prefix Use Unicode version of GetFinalPathNameByHandle Use EG(windows_version_info) instead of RtlGetVersion Use the specified handle_id instead of STD_OUTPUT_HANDLE Switch from stream name to stream resource Allow running tests capturing only stdout and/or stderr Add tests for stream_vt100_support function Export Win32 console functions Fix x64 build Use zend_long instead of long long, use GetConsole instead of GetFinalPathNameByHandleW to check if a handle is a valid console stream Always use zend_long on any platform Use _get_osfhandle to determine the standard handle Accept stream names Raise warnings in case of invalid stream parameter Return true if disabling VT100 support on a not-console/redirected stream or on old Windows versions Remove php_win32_console_os_supports_vt100 Differentiate stdin vs stdout/stderr Simplify setting flag Allow avoid piping STDIN Let stream_vt100_support accept only resources Fix run-tests Revert console flags in case of failure Simplify logic of stream_vt100_support when setting the flag Return true if succeeded, false otherwise Drop support for STDIN More comprehensive tests for stream_vt100_support Remove old tests Fix name of included file and use absolute paths Enable ENABLE_VIRTUAL_TERMINAL_PROCESSING on Windows by default Remove tests for stream_vt100_support Split stream_vt100_support into stream_isatty+sapi_windows_vt100_support Add tests for stream_isatty Add tests for sapi_windows_vt100_support Return null from stream_isatty is neither Windows nor Posix Fallback to S_ISCHR if neither Windows nor Posix Avoid defining argc since it's only used once Better comment about php_win32_console_fileno_is_console Use events instead of cNumberOfEvents Do not restore previous console mode We need to restore previous console mode on failing SetConsole calls only for STDIN Don't configure STDOUT/STDERR on Windows with PHP_CLI_WIN32_NO_CONSOLE
* | correct macro namesAnatol Belski2016-07-171-2/+2
| |
* | Pass error severity to SAPI modules and raise corresponding error level in ↵Martin Vobruba2016-07-111-1/+1
| | | | | | | | Apache
* | Fixed compilation warningsDmitry Stogov2016-06-281-9/+6
| |
* | Fixed compilation warningsDmitry Stogov2016-06-211-6/+2
| |
* | Merge branch 'master' of git.php.net:php-srcDmitry Stogov2016-06-201-2/+46
|\ \ | | | | | | | | | | | | * 'master' of git.php.net:php-src: Fixed the UTF-8 and long path support in the streams on Windows.