Commit Graph

608 Commits

Author SHA1 Message Date
Christoph M. Becker
49466af4b6
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7980: Unexpected result for iconv_mime_decode
2022-02-07 14:31:21 +01:00
Christoph M. Becker
86c196ba7f
Fix GH-7980: Unexpected result for iconv_mime_decode
We need to reset the shift state right after conversion, to cater to
potenially following plain encodings.  Also, there is no need to reset
the shift for plain encodings, because these are not state-dependent.

Closes GH-8025.
2022-02-07 14:28:57 +01:00
Christoph M. Becker
8009b216e9
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7953: ob_clean() only does not set Content-Encoding
2022-02-03 16:13:11 +01:00
Christoph M. Becker
9bd468da63
Fix GH-7953: ob_clean() only does not set Content-Encoding
If an output handler has not yet been started, calling `ob_clean()`
causes it to start.  If that happens, we must not forget to set the
`Content-Encoding` and `Vary` headers.

Closes GH-7960.
2022-02-03 16:09:00 +01:00
Máté Kocsis
fdc6082902
Generate optimizer func info from stubs for various extensions (#7409)
ext/hash, ext/iconv, ext/mbstring, ext/xml, ext/zlib
2021-08-26 19:52:11 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Nikita Popov
1eaaabca2b Move test from intl to iconv
Somehow this iconv-specific test ended up in ext/intl instead.
2021-06-14 15:03:46 +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
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
Max Semenik
e9f783fcdd Migrate skip checks to --EXTENSIONS--, p3
For rationale, see #6787

Extensions migrated in part 3:
* ftp
* gmp
* iconv
* opcache
* shmop
2021-04-03 15:23:25 +02:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +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
Máté Kocsis
99b08ac281
Implicitly enable function entry generation when class entry generation is enabled
Closes GH-6675
2021-02-09 13:37:24 +01:00
Máté Kocsis
98fb565c74
Generate class entries from stubs for another batch of extensions
Closes GH-6669
2021-02-08 19:53:55 +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
Nikita Popov
64cebf3d9a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Make iconv errno support test pass on Solaris.
2020-10-09 15:25:23 +02:00
Nikita Popov
58af1e156e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Make iconv errno support test pass on Solaris.
2020-10-09 15:24:53 +02:00
Petr Sumbera
07a4185df1 Make iconv errno support test pass on Solaris.
Closes GH-6291.
2020-10-09 15:24:36 +02:00
Nikita Popov
a4331a67f4 Update iconv parameter names
And rename charset to encoding, including inside error messages.

Closes GH-6234.
2020-09-29 18:11:07 +02:00
Nikita Popov
42168304b5 Consistently handle out of bounds offsets in iconv_strpos()
Same as in all other strpos() style functions, throw ValueError on
out of bounds offset.
2020-09-28 14:24:38 +02:00
Nikita Popov
978a44c9c6 Simplify iconv_strpos implementation
Use a separate "reverse" flag to determine search direction,
using offset == -1 to indicate this is is confusing. I initially
thought the code was trying to handle negative offsets.

Also deduplicate the forward and reverse cases, they really only differ
in one place.
2020-09-28 14:17:49 +02:00
Nikita Popov
9e3f352691 Throw warning for invalid iconv charset 2020-09-28 12:51:25 +02:00
Nikita Popov
13b791c79c Normalize substr() behavior
Make the behavior of substr(), mb_substr(), iconv_substr() and
grapheme_substr() consistent when it comes to the handling of
out of bounds offsets. substr() will now always clamp out of
bounds offsets to the string boundary. Cases that previously
returned false will now return an empty string. This means that
substr() itself *always* returns a string now (like mb_substr()
already did before.)

Closes GH-6182.
2020-09-25 09:58:21 +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
Dmitry Stogov
4a2ae84188 Add "const". Move constant strings to read-only memory. 2020-09-07 21:35:48 +03: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
8bc505cf47 Remove some duplicate iconv path logic
PHP_SETUP_ICONV already adds the include path to INCLUDES and the
library path to SHARED_LIBADD.
2020-08-07 18:10:29 +02:00
Nikita Popov
7bd1d70341 Remove PHP_ICONV_H_PATH
Directly include <iconv.h> instead, now that the giconv.h
distinction no longer exists.
2020-08-07 17:03:41 +02:00
Nikita Popov
2d359749a4 Remove giconv support
The best information I was able to find about this is this mail
from 2009 which indicates that giconv is an old FreeBSD iconv
implementation that has long since been superseded by libiconv.

https://lists.samba.org/archive/samba-technical/2009-June/065177.html
2020-08-07 17:03:41 +02:00
Nikita Popov
65592840f0 Remove more leftovers of PHP_DEFINE handling 2020-08-07 17:03:41 +02:00
Nikita Popov
e6f7784210 Don't use PHP_DEFINE in iconv
iconv is the only consumer of this custom define mechanism that
puts every define into a single file. Use the standard mechanism
instead.
2020-08-07 14:29:04 +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
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
George Peter Banyard
c803499e23 Remove depreacted curly brace offset syntax
Closes GH-5221
2020-05-22 16:52:17 +02:00
George Peter Banyard
9cc24baa1c Fix [-Wundef] warning in Iconv extension 2020-05-20 18:22:09 +02:00
Máté Kocsis
3ebce8e9fc
Fix UNKNOWN default values in various extensions
Closes GH-5514
2020-05-05 19:08:20 +02:00
Máté Kocsis
1f48feebb9
Improve some TypeError and ValueError messages
Closes GH-5377
2020-04-14 14:38:45 +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
5322de1ba8
Generate functions entries from stubs for another set of extensions
Closes GH-5351
2020-04-05 00:59:44 +02:00
Christoph M. Becker
324337a3b1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79200: Some iconv functions cut Windows-1258
2020-03-23 14:31:16 +01:00
Christoph M. Becker
a7bbfc95eb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79200: Some iconv functions cut Windows-1258
2020-03-23 14:13:42 +01:00
Christoph M. Becker
32a2644305 Fix #79200: Some iconv functions cut Windows-1258
To cater to potentially state-dependent encodings, we have to reset the
conversion descriptor into its initial shift state to properly finish
the conversion.  Furthermore, state-dependent encodings may not show
progress when comparing `in_left` before and after the conversion; we
rather have to see whether `out_left` has decreased.  Also we have to
cater to the fact that the final potentially state resetting call does
not signal failure, but we still have to break respective loops
afterwards.
2020-03-23 14:12:37 +01:00
Christoph M. Becker
66d8d0c7d7 Drop support for iconv without proper errno setting
It is hard to impossible to work around iconv() implementations which
do not properly set errno according to POSIX.  We therefore do no
longer allow to build against such iconv() implementations.

Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
2020-03-17 14:02:29 +01:00
George Peter Banyard
e4e1746b3f Remove unnecessary condition as always true.
ZSTR_LEN(str) is an unsigned integer therefor it is always greater
or equal than 0.

Detected by -Wtype-limits compiler warning.
2020-02-05 17:44:20 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +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
Máté Kocsis
aadd3aaed9
Use RETURN_THROWS() in various places 2020-01-03 21:10:24 +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