Commit Graph

844 Commits

Author SHA1 Message Date
Nikita Popov
a733b1ada7 Restore zend_atoi()
I dropped this in preparation for changes that I didn't end up
doing. Restore the function for now to avoid unnecessary churn for
extensions.
2021-07-16 14:46:56 +02:00
Nikita Popov
1cba7764b4
Remove zend_atoi() (#7232)
It's the same as (int) zend_atol() -- it doesn't try to do anything
integer size specific. Canonicalize to one function in preparation
for renaming zend_atol() to something less misleading.

FFI test is adjusted to use a zend_test function. It just calls
zend_atol() internally, but could really be anything.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-07-13 09:22:31 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Nikita Popov
9871a624bf Clean up some more function_exists() checks 2021-06-14 15:47:08 +02:00
Nikita Popov
6600ad6067 Add some missing EXTENSIONS sections to misc tests 2021-06-14 14:52:44 +02:00
Nikita Popov
39131219e8
Migrate more SKIPIF -> EXTENSIONS (#7139)
This is a mix of more automated and manual migration. It should remove all applicable extension_loaded() checks outside of skipif.inc files.
2021-06-11 12:58:44 +02:00
Nikita Popov
7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00
George Peter Banyard
b6958bb847
Implement "Deprecate implicit non-integer-compatible float to int conversions" RFC. (#6661)
RFC: https://wiki.php.net/rfc/implicit-float-int-deprecate

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-05-31 15:48:45 +01:00
George Peter Banyard
aca6aefd85
Remove 'register' type qualifier (#6980)
The compiler should be smart enough to optimize this on its own
2021-05-14 13:38:01 +01: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
Christoph M. Becker
93e6796fc0
Merge branch 'PHP-8.0'
* PHP-8.0:
  Export gzfwrite()
2021-04-26 12:12:48 +02:00
Christoph M. Becker
fe219d912e
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Export gzfwrite()
2021-04-26 12:12:04 +02:00
Christoph M. Becker
a2771296c0
Export gzfwrite()
Extensions calling `gzfwrite()` cannot be built when linked against
php.dll (built with zlib support) otherwise.

Closes GH-6880.
2021-04-26 12:09:31 +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
George Peter Banyard
09efad615b
Use zend_string_equals_(literal_)ci() API more often
Also drive-by usage of zend_ini_parse_bool()

Closes GH-6844
2021-04-09 02:34:50 +01:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
George Peter Banyard
8a86fe11da
Add missing break; in Zlib extension 2021-04-07 00:46:17 +01:00
Levi Morrison
8d743d5281
Revert "Revert "Revert "[skip-ci] Fix typo"""
This reverts commit 2b0f239b21.
2021-03-28 11:53:30 -06:00
Nikita Popov
2b0f239b21 Revert "Revert "[skip-ci] Fix typo""
This reverts commit 046827a7e8.
2021-03-28 18:15:57 +02:00
Nikita Popov
046827a7e8 Revert "[skip-ci] Fix typo"
This reverts commit c730aa26bd.

This looks like the result of a compromised git account. Commit
access has already been revoked.
2021-03-28 11:16:39 +02:00
Rasmus Lerdorf
c730aa26bd [skip-ci] Fix typo
Fixes minor typo.

Signed-off-by: Rasmus Lerdorf <rasmus@lerdorf.com>
2021-03-28 05:57:07 +02:00
Máté Kocsis
4c6533c257
Generate class entries from stubs for com, standard, xmlreader, xmlwriter, xsl, zip, Zend
Closes GH-6706
2021-02-22 15:24:03 +01:00
Nikita Popov
ce0bc58c22 Merge branch 'PHP-8.0'
* PHP-8.0:
  Mark resource-like objects as non-comparable
2021-02-16 14:22:03 +01:00
Nikita Popov
b63ea1047a Mark resource-like objects as non-comparable
As these hold on to some internal resource, there can't be two
"equal" objects with different identity. Make sure the lack of
public properties doesn't result in these being treated as always
equal.
2021-02-16 14:20:45 +01:00
Nikita Popov
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +01:00
Nikita Popov
2b677aaa34 Merge branch 'PHP-8.0'
* PHP-8.0:
  Sync gzgets signature with fgets
2021-01-18 15:47:31 +01:00
Nikita Popov
7290dc4dcf Sync gzgets signature with fgets 2021-01-18 15:47:12 +01:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Christoph M. Becker
fb4bc0f9e5 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #48725: Support for flushing in zlib stream
2020-12-08 12:24:49 +01:00
Christoph M. Becker
20e75329f2 Fix #48725: Support for flushing in zlib stream
When `php_zlib_deflate_filter()` is called with `PSFS_FLAG_FLUSH_INC`
but without new buckets being available (e.g. because a user calls
`rewind()` after writing to the stream), we have to make sure that any
pending data are flushed.  This could basically be done like in the
attached patch[1], but that could cause unnessary flushes, which can be
harmful for compression, and adds unnecessary flush markers to the
stream.  Thus, we use the `php_zlib_filter_data.finished` field, which
has not been used for `zlib.deflate` filters, and properly keep track
of the need to flush.

[1] <https://bugs.php.net/patch-display.php?bug_id=48725&patch=zlib-filter-flush-fix.patch&revision=latest>

Closes GH-6019.
2020-12-08 12:23:24 +01:00
Christoph M. Becker
d6ae0f010e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #77069: stream filter loses final block of data
2020-12-08 11:49:28 +01:00
Christoph M. Becker
65f5573bc8 Fix #77069: stream filter loses final block of data
Reading from a stream may return greater than zero, but nonetheless the
stream's EOF flag may have been set.  We have to cater to this
condition by setting the close flag for filters.

We also have to cater to that change in the zlib.inflate filter:

If `inflate()` is called with flush mode `Z_FINISH`, but the output
buffer is not large enough to inflate all available data, it fails with
`Z_BUF_ERROR`.  However, `Z_BUF_ERROR` is not fatal; in fact, the zlib
manual states: "If deflate returns with Z_OK or Z_BUF_ERROR, this
function must be called again with Z_FINISH and more output space
(updated avail_out) but no more input data, until it returns with
Z_STREAM_END or an error."  Hence, we do so.

Closes GH-6001.
2020-12-08 11:47:49 +01:00
Máté Kocsis
d6264b0966
Verify parameter names of function aliases
Closes GH-6335
2020-10-16 10:56:33 +02:00
Nikita Popov
79484b4f8a Update ext/sockets parameter names
Also change $max_length to $length in a number of filesystem APIs,
where our usage was inconsistent.

Closes GH-6276.
2020-10-06 12:12:43 +02:00
Máté Kocsis
e9c707298b
Review parameter names in ext/zlib
Closes GH-6250
2020-10-05 15:20:27 +02:00
Máté Kocsis
e950ca13ea
Consolidate the usage of "either" and "one of" in error messages
Closes GH-6173
2020-09-20 19:41:47 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
2c96780e1c
Fix UNKNOWN default values in ext/standard
Closes GH-6026
2020-09-07 18:58:11 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Nikita Popov
b3f0f35fd7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix file clash in zlib test
2020-08-06 12:35:37 +02:00
Nikita Popov
a35379de2e Fix file clash in zlib test 2020-08-06 12:34:14 +02:00
George Peter Banyard
c3105a1f8d ValueError for empty path in stream code
Closes GH-5902
2020-07-31 13:39:58 +01:00
Máté Kocsis
d30cd7d7e7
Review the usage of apostrophes in error messages
Closes GH-5590
2020-07-10 21:05:28 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Máté Kocsis
b5c7a83dca
Remove unnecessary PHPDoc-alike blocks from tests
Closes GH-5759
2020-06-24 13:13:44 +02:00
Nikita Popov
653e4ea1c5 Add flag to forbid dynamic property creation on internal classes
While performing resource -> object migrations, we're adding
defensive classes that are final, non-serializable and non-clonable
(unless they are, of course). This path adds a ZEND_ACC_NO_DYNAMIC_PROPERTIES
flag, that also forbids the creation of dynamic properties on these objects.
This is a subset of #3931 and targeted at internal usage only
(though may be extended to userland at some point in the future).

It's already possible to achieve this (what the removed
WeakRef/WeakMap code does), but there's some caveats: First, this
simple approach is only possible if the class has no declared
properties, otherwise it's necessary to special-case those
properties. Second, it's easy to make it overly strict, e.g. by
forbidding isset($obj->prop) as well. And finally, it requires a
lot of boilerplate code for each class.

Closes GH-5572.
2020-06-24 11:52:36 +02:00
Nikita Popov
c9b9f525a9 Include stub hash in generated arginfo files
The hash is used to check whether the arginfo file needs to be
regenerated. PHP-Parser will only be downloaded if this is actually
necessary.

This ensures that release artifacts will never try to regenerate
stubs and thus fetch PHP-Parser, as long as you do not modify any
files.

Closes GH-5739.
2020-06-24 09:55:19 +02:00
Máté Kocsis
314eedbc35
Convert resources to objects in ext/zlib
Closes GH-5680
2020-06-17 16:50:00 +02:00
Máté Kocsis
1efaed7cf7
Improve error messages of ext/zlib 2020-06-17 16:50:00 +02:00
Nikita Popov
c6a6ca078b Use zend_zval_type_name() API where possible
Rather than zend_get_type_by_const(Z_TYPE_P()).
2020-05-13 14:56:05 +02:00
Alex Dowad
8ddaf13ed3 Code tweaks: Remove unneeded semicolons 2020-04-29 23:17:40 +02:00
Nikita Popov
41c7d28c11 Add macro to get ini target address 2020-04-27 10:30:00 +02:00
Christoph M. Becker
3d1b730c11 Fix #71417: fread() does not report zlib.inflate errors
If the zlib.inflate filter fails to decompress the stream, we raise a
notice instead of failing silently.
2020-04-20 16:49:08 +02:00
Máté Kocsis
3709e74b5e
Store default parameter values of internal functions in arg info
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-04-08 18:37:51 +02:00
Máté Kocsis
21cfa03f17
Generate function entries for another batch of extensions
Closes GH-5352
2020-04-05 21:15:30 +02:00
Máté Kocsis
a43bc33fb2
Annotate function aliases in stubs 2020-04-04 13:03:16 +02:00
Máté Kocsis
01b266aac4
Improve error messages of various extensions
Closes GH-5278
2020-03-23 18:59:04 +01:00
Máté Kocsis
bb6f374048
Improve argument error messages in ext/standard
Closes GH-5198
2020-03-18 19:56:10 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
George Peter Banyard
9a76a2a032 Convert some warnings into ValueErrors in the standard file extension
Closes GH-5007
2020-01-27 23:20:40 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
George Peter Banyard
928afd8fb7 Convert some warnings to Error in zlib extension
Closes GH-4985
2020-01-09 00:56:58 +01:00
Máté Kocsis
345703724c
Use RETURN_THROWS() during ZPP in most of the extensions
Except for some bigger ones: reflection, sodium, spl
2019-12-31 11:46:11 +01:00
Máté Kocsis
d59bc80782
Fix smaller issues with stubs
GH-5025
2019-12-20 14:31:07 +01:00
Máté Kocsis
27e83d0fb8
Add union return types for function stubs 2019-11-11 14:54:55 +01:00
Fabien Villepinte
a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Máté Kocsis
9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Christoph M. Becker
68edbbfe76 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add the last missing SKIPIF
2019-09-04 08:54:07 +02:00
Fabien Villepinte
ced5bb7d88 Add the last missing SKIPIF 2019-09-04 08:53:35 +02:00
Thomas Gerbet
70fa43edbe Add stub for ext zlib 2019-08-22 11:01:51 +02:00
Nikita Popov
a1e2c8870e Merge branch 'PHP-7.4' 2019-07-22 17:26:01 +02:00
Nikita Popov
d59aac58b3 Report errors from stream read and write operations
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.

As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).

I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Nikita Popov
eb766751dc Merge branch 'PHP-7.4' 2019-07-19 10:06:30 +02:00
rjhdby
d574df63dc Deprecate alternative array access syntax
RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
2019-07-19 10:06:10 +02:00
Nikita Popov
0146bab449 Merge branch 'PHP-7.4' 2019-07-12 12:55:21 +02:00
Nikita Popov
9345c191db Remove unnecessary uses of restore_include_path() in tests 2019-07-12 12:54:26 +02:00
Joe Watkins
956db0cdc2
Merge branch 'PHP-7.4'
* PHP-7.4:
  fix mac tests on azure
2019-06-14 12:58:13 +02:00
Joe Watkins
f16b012116
fix mac tests on azure 2019-06-14 12:55:00 +02:00
Nikita Popov
7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +02:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Nikita Popov
1df8175b61 Convert fetch_resource warnings into TypeErrors
More type checks that are not part of zpp and should generate a
TypeError in PHP 8.
2019-06-03 09:17:12 +02:00
Peter Kokot
54e7acddf9 Merge branch 'PHP-7.4'
* PHP-7.4:
  Use *.data for fixture files
2019-05-17 04:00:04 +02:00
Peter Kokot
bd1bd38a35 Use *.data for fixture files 2019-05-17 03:59:23 +02:00
Peter Kokot
2cf90bb2f0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Normalize comments in *nix build system m4 files
2019-05-12 18:51:50 +02:00
Peter Kokot
75fb74860d Normalize comments in *nix build system m4 files
Normalization include:
- Use dnl for everything that can be ommitted when configure is built in
  favor of the shell comment character # which is visible in the output.
- Line length normalized to 80 columns
- Dots for most of the one line sentences
- Macro definitions include similar pattern header comments now
2019-05-12 18:43:03 +02:00
Nikita Popov
8047cf9ba4 Merge branch 'PHP-7.4' 2019-04-26 15:05:56 +02:00
Nikita Popov
2371c65a28 Fix file name clash in zlib tests 2019-04-26 15:05:42 +02:00
Nikita Popov
4e6a33dc2b Merge branch 'PHP-7.4' 2019-04-10 13:39:59 +02:00
Nikita Popov
397ee767fd Make zlib include_path tests more robust
One file is placed inside the script directory, we need to make
sure it has a unique name as well.
2019-04-10 13:39:17 +02:00
Peter Kokot
6426420f61 Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace dirname(__FILE__) by __DIR__ in tests
2019-03-15 23:36:47 +01:00
Fabien Villepinte
26dfce7f36 Replace dirname(__FILE__) by __DIR__ in tests 2019-03-15 22:55:30 +01:00
Nikita Popov
852485d8ec Adjust tests for zpp TypeError change 2019-03-11 11:32:20 +01:00
Peter Kokot
d0fd9fe977 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add AS_HELP_STRING to *nix build configure options
2019-03-07 20:38:04 +01:00
Peter Kokot
9df6a1e4dd Add AS_HELP_STRING to *nix build configure options
The Autoconf's default AS_HELP_STRING macro can properly format help
strings [1] so watching out if columns are aligned manually is not
anymore.

[1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Pretty-Help-Strings
2019-03-07 20:36:59 +01:00
Nikita Popov
a32b89f029 Merge branch 'PHP-7.4' 2019-03-05 11:03:09 +01:00
Nikita Popov
94d509363d Remove more zpp error tests 2019-03-05 11:02:31 +01:00
Nikita Popov
93ee216966 Merge branch 'PHP-7.4' 2019-02-22 11:26:26 +01:00
Nikita Popov
1c9fe30425 Fix directory collisions in zlib tests 2019-02-22 11:25:52 +01:00
Nikita Popov
790798f61e Merge branch 'PHP-7.4' 2019-02-05 12:43:13 +01:00