Commit graph

426 commits

Author SHA1 Message Date
Ilija Tovilo
1a0ef2c1cc
Revert "Remove name field from the zend_constant struct (#10954)"
This reverts commit f42992f580.

Closes GH-11604
2023-07-17 22:32:41 +02:00
Niels Dossche
f16b34f1d0 Implement GH-10024: support linting multiple files at once using php -l
This is supported in both the CLI and CGI modes. For CLI this required
little changes.

For CGI, the tricky part was that the options parsing happens inside the
loop. This means that options passed after the -l flag were previously
simply ignored. As we now re-enter the loop we would parse the options
again, and if they are handled but don't set the script name, then CGI
will think you want to read from standard in. To keep the same "don't
parse options" behaviour I simply wrapped the options handling inside an
if.

Closes GH-10024.
Closes GH-10710.
2023-07-05 15:20:36 +02:00
Ilija Tovilo
ad1b70d67e
Revert "Revert "Remove name field from the zend_constant struct (#10954)""
This reverts commit 9f4bd3040d.
2023-07-04 16:42:40 +02:00
Máté Kocsis
9f4bd3040d
Revert "Remove name field from the zend_constant struct (#10954)"
This reverts commit f42992f580.

Fix GH-11423
2023-07-03 15:16:24 +02:00
nielsdos
d8ee89d3fa Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix interrupted CLI output causing the process to exit
2023-06-23 17:43:01 +02:00
nielsdos
b9bf9ee2cb Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix interrupted CLI output causing the process to exit
2023-06-23 17:42:45 +02:00
nielsdos
1111a9517b Fix interrupted CLI output causing the process to exit
When writing the output in the CLI is interrupted by a signal, the
writing will fail in sapi_cli_single_write(), causing an exit later in
sapi_cli_ub_write(). This was the other part of the issue in GH-11498.
The solution is to restart the write if an EINTR has been observed.

Closes GH-11510.
2023-06-23 17:39:04 +02:00
George Peter Banyard
d5ad75108e
More usage of known zend_str instead of C string (#11381) 2023-06-08 13:03:29 +01:00
Niels Dossche
ac5920f92b Fix GH-11141: Could not open input file: should be sent to stderr
I grepped for php_printf cases in main/ and sapi/ and converted the
cases which clearly indicate errors to fprintf(stderr, ...), like
suggested in the linked issue.

Closes GH-11163.
2023-05-05 19:31:23 +02:00
nielsdos
f6c0c60ef6 Fix GH-11104: STDIN/STDOUT/STDERR is not available for CLI without a script
I found no reason why this is done this way.
Of course this will allow users to do stupid stuff like
`fclose(STDOUT);` etc. but if they type in that code they clearly know
what they're doing...

Close GH-11169.
2023-05-03 19:54:21 +02:00
Máté Kocsis
f42992f580
Remove name field from the zend_constant struct (#10954)
As global constant names are case-sensitive now, we don't have to store them separately above the constant table.
2023-04-03 22:13:47 +02:00
Niels Dossche
f247e48def
Remove always-false check in CLI (#10723)
This is the case c == 'i', so c == '?' is always false, hence the result
is always 0.
2023-02-28 12:24:09 +01:00
Christoph M. Becker
c8955c078a
Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01:00
Max Kellermann
6b34de8eba sapi/*: add missing includes 2023-01-10 14:19:03 +00:00
Jorg Adam Sowa
77ee92a50c
Remove unnecessary usage of CONST_CS
Closes GH-9685.
2022-11-28 17:12:07 +01:00
Jakub Zelenka
0a4a55fd44
Allow to not close stream on rscr dtor in php cli sapi 2022-07-18 10:58:50 +01:00
Arnaud Le Blanc
61ad0d9136 Fix build 2022-07-09 23:30:15 +02:00
Arnaud Le Blanc
da1cbd20c3 Merge branch 'PHP-8.1'
* PHP-8.1:
  [ci skip] NEWS
  Fix GH-8952: std streams can not be deliberately closed (#8953)
  intl extension, build fix for icu >= 69.x release. ubrk/ucnv_safeClone had been deprecated in favor of ubrk/ucnv_clone which does not use user provided stacks but remain thread safe.
2022-07-09 23:01:07 +02:00
Arnaud Le Blanc
2dbde18b29
Fix GH-8952: std streams can not be deliberately closed (#8953) 2022-07-09 22:58:02 +02:00
Christoph M. Becker
b8dee9b3fc
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8827: Intentionally closing std handles no longer possible
2022-06-20 18:04:34 +02:00
Christoph M. Becker
a8437d08a8
Fix GH-8827: Intentionally closing std handles no longer possible
We revert the commits which caused this regression from the PHP-8.0 and
PHP-8.1 branches for now.  We keep it in "master" because of PR #8833
which may offer a proper fix without BC break.
2022-06-20 18:01:02 +02:00
George Peter Banyard
5ba6ecd523
Minor refactoring of main/main.c and TSRM (#8608) 2022-05-24 08:34:55 +01:00
Levi Morrison
c53c3e200b Stop closing stderr and stdout streams (#8571)
Extensions may (and do) write to stderr in mshutdown and similar. In
the best case, with the stderr stream closed, it's just swallowed.

However, some libraries will do things like try to detect color, and
these will outright fail and cause an error path to be taken.
2022-05-20 13:41:02 +02:00
Arnaud Le Blanc
980385d12d Merge branch 'PHP-8.1'
* PHP-8.1:
  Stop closing stderr and stdout streams (#8570)
  Revert "XFAIL tests (GH-8588)"
  XFAIL tests (GH-8588)
  Stop closing stderr and stdout streams (#8569)
2022-05-20 13:40:27 +02:00
Levi Morrison
ffd27bdec4 Stop closing stderr and stdout streams (#8570)
Extensions may (and do) write to stderr in mshutdown and similar. In
the best case, with the stderr stream closed, it's just swallowed.

However, some libraries will do things like try to detect color, and
these will outright fail and cause an error path to be taken.
2022-05-20 13:40:09 +02:00
Arnaud Le Blanc
6465f3ed13 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  XFAIL tests (GH-8588)
  Stop closing stderr and stdout streams (#8569)
2022-05-20 13:36:22 +02:00
Levi Morrison
fa78e17724 Stop closing stderr and stdout streams (#8569)
Extensions may (and do) write to stderr in mshutdown and similar. In
the best case, with the stderr stream closed, it's just swallowed.

However, some libraries will do things like try to detect color, and
these will outright fail and cause an error path to be taken.
2022-05-20 13:27:23 +02:00
George Peter Banyard
9601475ebb
Minimal refactoring of CLI SAPI (#8519)
More specific types, some cleanup and voidifying functions which always return ``SUCCESS``
2022-05-09 22:29:16 +01:00
George Peter Banyard
b5db594fd2
Refacto php_module_startup() (#8303)
It only ever uses at most 1 additional modules
2022-04-27 23:07:11 +01:00
Max Kellermann
d87ba95acd
sapi/*: move duplicate "--define" code to library 2022-04-18 16:52:08 +02:00
Dmitry Stogov
90b7bde615 Use more compact representation for packed arrays.
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
  instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
  familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
  (ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
  (packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
  ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
    - sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
    - zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
Christoph M. Becker
be5fd30d54
Fix Windows debug builds
`ZEND_ATOL` doesn't accept a size argument.
2021-07-16 00:41:38 +02:00
Christoph M. Becker
497858a043
Merge branch 'PHP-8.0'
* PHP-8.0:
  exit_status is no longer a true global
2021-07-12 23:40:16 +02:00
Christoph M. Becker
1631b96b4b
exit_status is no longer a true global 2021-07-12 23:39:10 +02:00
Christoph M. Becker
057d2f2a00
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #73226: --r[fcez] always return zero exit code
2021-07-12 23:14:15 +02:00
Christoph M. Becker
0c0ecf0470
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73226: --r[fcez] always return zero exit code
2021-07-12 23:12:19 +02:00
Christoph M. Becker
9db3eda2cb
Fix #73226: --r[fcez] always return zero exit code
This makes the behavior consistent with `--ri`, and is likely useful
for scripting.

Closes GH-7221.
2021-07-12 23:09:28 +02:00
Nikita Popov
989205e95c Remove incorrect uses of zend_atoi()
zend_atoi() parses integers with size suffixes (like "128M").
These just want to use a plain number, so use ZEND_ATOL instead.
2021-07-12 16:56:00 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Nikita Popov
959e5787bd Disable -a mode without readline
To avoid confusing, as -a without readline is not actually
interactive.

Discussion: https://externals.io/message/114426

Closes GH-6976.
2021-05-14 12:10:46 +02:00
Nikita Popov
07061482a0 Fix segfault in php -a without readline 2021-05-11 11:39:04 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Michael Voříšek
4d78598e8e Remove spaces around version built type 2021-04-27 10:12:28 +02:00
Josh Soref
462da6e09c Fix spelling and grammar mistakes
This PR corrects misspellings identified by the check-spelling action.

The misspellings have been reported at jsoref@b6ba3e2#commitcomment-48946465

The action reports that the changes in this PR would make it happy: jsoref@602417c

Closes GH-6822.
2021-04-13 12:09:37 +02:00
Nikita Popov
4ce5d2ea88 Add known strings for jit autoglobals
We always create interned strings for all autoglobals anyway, so
we might as well add known strings to make them more widely usable.
2021-04-09 15:37:59 +02:00
Dmitry Stogov
c732ab400a Change Zend Stream API to use zend_string* instead of char*.
This allows to eliminate re-calculation of string lenght and hash value.
See the detailed list of changes in UPGRADING.INTERNALS.
2021-03-16 20:31:36 +03:00
Christoph M. Becker
d03be8bf86 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
2021-02-22 14:34:45 +01:00
Christoph M. Becker
1d2bbce532 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
2021-02-22 14:34:21 +01:00
Christoph M. Becker
073b6ea818 Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
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.
2021-02-22 14:31:51 +01:00
Dmitry Stogov
ba89dcb75a Fixed crash in ZTS build with --repeat option 2021-01-21 11:39:13 +03:00