Commit Graph

595 Commits

Author SHA1 Message Date
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
Máté Kocsis
f3d5a5a9d3
Promote warnings to exceptions in string search related functions
GH-5004
2019-12-20 16:43:40 +01:00
Christoph M. Becker
dccd137e1a iconv_strlen() cannot return a string 2019-11-11 15:40:59 +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
Colin O'Dell
e6d3146bdc Accept null lengths for substr functions()
If a null $length is passed to any of these functions, behave as if no
parameter was passed:

 - substr()
 - substr_count()
 - substr_compare()
 - iconv_substr()
2019-10-22 12:09:04 +02:00
Christoph M. Becker
8548a1bdec Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78642: Wrong libiconv version displayed
2019-10-08 12:11:19 +02:00
Christoph M. Becker
346be2cf59 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78642: Wrong libiconv version displayed
2019-10-08 12:10:58 +02:00
Christoph M. Becker
d6fdc17f7f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78642: Wrong libiconv version displayed
2019-10-08 12:10:06 +02:00
Christoph M. Becker
195c2008e8 Fix #78642: Wrong libiconv version displayed
The high byte of `_libiconv_version` specifies the major version; the
low byte the minor version.
2019-10-08 12:09:11 +02: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
bba7f38c4f Don't explicitly set return value on ZPP failure in ext/iconv
Failing ZPP throws as of PHP 8.0.0, so explicitly setting a return
value is useless, and also slightly confusing.
2019-08-23 18:14:46 +02:00
Christoph M. Becker
d420336115 Add ext/iconv stubs 2019-08-23 18:14:45 +02:00
Christoph M. Becker
3f3aac1d07 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78342: Bus error in configure test for iconv //IGNORE
2019-07-29 08:52:11 +02:00