summaryrefslogtreecommitdiff
path: root/sapi/cli/php_cli.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | 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.
| * | Fixed the UTF-8 and long path support in the streams on Windows.Anatol Belski2016-06-201-2/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since long the default PHP charset is UTF-8, however the Windows part is out of step with this important point. The current implementation in PHP doesn't technically permit to handle UTF-8 filepath and several other things. Till now, only the ANSI compatible APIs are being used. Here is more about it https://msdn.microsoft.com/en-us/library/windows/desktop/dd317752%28v=vs.85%29.aspx The patch fixes not only issues with multibyte filenames under incompatible codepages, but indirectly also issues with some other multibyte encodings like BIG5, Shift-JIS, etc. by providing a clean way to access filenames in UTF-8. Below is a small list of issues from the bug tracker, that are getting fixed: https://bugs.php.net/63401 https://bugs.php.net/41199 https://bugs.php.net/50203 https://bugs.php.net/71509 https://bugs.php.net/64699 https://bugs.php.net/64506 https://bugs.php.net/30195 https://bugs.php.net/65358 https://bugs.php.net/61315 https://bugs.php.net/70943 https://bugs.php.net/70903 https://bugs.php.net/63593 https://bugs.php.net/54977 https://bugs.php.net/54028 https://bugs.php.net/43148 https://bugs.php.net/30730 https://bugs.php.net/33350 https://bugs.php.net/35300 https://bugs.php.net/46990 https://bugs.php.net/61309 https://bugs.php.net/69333 https://bugs.php.net/45517 https://bugs.php.net/70551 https://bugs.php.net/50197 https://bugs.php.net/72200 https://bugs.php.net/37672 Yet more related tickets can for sure be found - on bugs.php.net, Stackoverflow and Github. Some of the bugs are pretty recent, some descend to early 2000th, but the user comments in there last even till today. Just for example, bug #30195 was opened in 2004, the latest comment in there was made in 2014. It is certain, that these bugs descend not only to pure PHP use cases, but get also redirected from the popular PHP based projects. Given the modern systems (and those supported by PHP) are always based on NTFS, there is no excuse to keep these issues unresolved. The internalization approach on Windows is in many ways different from UNIX and Linux, while it supports and is based on Unicode. It depends on the current system code page, APIs used and exact kind how the binary was compiled The locale doesn't affect the way Unicode or ANSI API work. PHP in particular is being compiled without _UNICODE defined and this is conditioned by the way we handle strings. Here is more about it https://msdn.microsoft.com/en-us/library/tsbaswba.aspx However, with any system code page ANSI functions automatically convert paths to UTF-16. Paths in some encodings incompatible with the current system code page, won't work correctly with ANSI APIs. PHP till now only uses the ANSI Windows APIs. For example, on a system with the current code page 1252, the paths in cp1252 are supported and transparently converted to UTF-16 by the ANSI functions. Once one wants to handle a filepath encoded with cp932 on that particular system, an ANSI or a POSIX compatible function used in PHP will produce an erroneous result. When trying to convert that cp932 path to UTF-8 and passing to the ANSI functions, an ANSI function would likely interpret the UTF-8 string as some string in the current code page and create a filepath that represents every single byte of the UTF-8 string. These behaviors are not only broken but also disregard the documented INI settings. This patch solves the issies with the multibyte paths on Windows by intelligently enforcing the usage of the Unicode aware APIs. For functions expect Unicode (fe CreateFileW, FindFirstFileW, etc.), arguments will be converted to UTF-16 wide chars. For functions returning Unicode aware data (fe GetCurrentDirectoryW, etc.), resulting wide string is converted back to char's depending on the current PHP charset settings, either to the current ANSI codepage (this is the behavior prior to this patch) or to UTF-8 (the default behavior). In a particular case, users might have to explicitly set internal_encoding or default_charset, if filenames in ANSI codepage are necessary. Current tests show no regressions and witness that this will be an exotic case, the current default UTF-8 encoding is compatible with any supported system. The dependency libraries are long switching to Unicode APIs, so some tests were also added for extensions not directly related to streams. At large, the patch brings over 150 related tests into the core. Those target and was run on various environments with European, Asian, etc. codepages. General PHP frameworks was tested and showed no regressions. The impact on the current C code base is low, the most places affected are the Windows only places in the three files tsrm_win32.c, zend_virtual_cwd.c and plain_wrapper.c. The actual implementation of the most of the wide char supporting functionality is in win32/ioutil.* and win32/codepage.*, several low level functionsare extended in place to avoid reimplementation for now. No performance impact was sighted. As previously mentioned, the ANSI APIs used prior the patch perform Unicode conversions internally. Using the Unicode APIs directly while doing custom conversions just retains the status quo. The ways to optimize it are open (fe. by implementing caching for the strings converted to wide variants). The long path implementation is user transparent. If a path exceeds the length of _MAX_PATH, it'll be automatically prefixed with \\?\. The MAXPATHLEN is set to 2048 bytes. Appreciation to Pierre Joye, Matt Ficken, @algo13 and others for tips, ideas and testing. Thanks.
* | | Cleanup zend_signal APIDmitry Stogov2016-06-201-2/+0
|/ /
* | Merge branch 'PHP-7.0'Joe Watkins2016-04-291-1/+1
|\ \ | |/ | | | | | | * PHP-7.0: fix size_t signed comparison
| * fix size_t signed comparisonJoe Watkins2016-04-291-1/+1
| |
* | bug #71478 implementing feature requestMatt Ficken2016-03-211-0/+8
|/
* Fix bug #71624, PHP_MODE_PROCESS_STDIN (CLI SAPI called with '-R') did not ↵Sean DuBois2016-03-151-4/+3
| | | | properly set $argi and $argn
* Move semicolon into TSRMLS_CACHE_EXTERN/DEFINENikita Popov2016-03-031-1/+1
| | | | Also re bug #71575.
* be more precise about the meaning of -nJoe Watkins2016-02-101-1/+1
|
* Merge branch 'PHP-5.6' into PHP-7.0Lior Kaplan2016-01-011-2/+2
|\ | | | | | | | | * PHP-5.6: Happy new year (Update copyright to 2016)
| * Happy new year (Update copyright to 2016)Lior Kaplan2016-01-011-2/+2
| |
* | Add NTS/ZTS information to php -vBob Weinand2015-09-301-8/+11
| |
* | fix zend signal and tsrm compatzend-signal-ztsJoe Watkins2015-09-011-0/+4
| |
* | Switch position of ce in exception ce variable namesAaron Piotrowski2015-07-031-1/+1
| |
* | Change zend_exception_get_default() to zend_exception_ceAaron Piotrowski2015-07-031-1/+1
| |
* | integrate the openssl applink shimAnatol Belski2015-07-031-0/+4
| | | | | | | | | | | | | | | | | | This fixes ext/openssl/tests/openssl_spki_export.phpt failing with the no OPENSSL_Applink error. Applink is also an interesting technique documented in the OpenSSL FAQ https://www.openssl.org/support/faq.html#PROG2 which allows under circumstances using different OpenSSL binaries than those a program was linked with.