Commit Graph

608 Commits

Author SHA1 Message Date
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
Christoph M. Becker
fec71e3f25 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78342: Bus error in configure test for iconv //IGNORE
2019-07-29 08:51:33 +02:00
Christoph M. Becker
585131f901 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78342: Bus error in configure test for iconv //IGNORE
2019-07-29 08:50:39 +02:00
Christoph M. Becker
30eb4b3563 Fix #78342: Bus error in configure test for iconv //IGNORE
We have to check the return value of iconv_open() for error, to avoid
that and potentially other undesired behavior of iconv().
2019-07-29 08:48:13 +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
Dmitry Stogov
e029cc4dd4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Cheaper checks for exceptions thrown from __toString()
2019-06-06 02:23:17 +03:00
Dmitry Stogov
457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03: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
Stanislav Malyshev
12d68d0272 Merge branch 'PHP-7.4'
* PHP-7.4:
  Update NEWS
  Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow
  Fix #77973: Uninitialized read in gdImageCreateFromXbm
2019-05-27 16:49:37 -07:00
Stanislav Malyshev
5e3dc08826 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
  Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow
  Fix #77973: Uninitialized read in gdImageCreateFromXbm
2019-05-27 16:49:31 -07:00
Stanislav Malyshev
c7eb0feed8 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
  Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow
  Fix #77973: Uninitialized read in gdImageCreateFromXbm
2019-05-27 16:49:25 -07:00
Stanislav Malyshev
e77c8e45ba Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow
  Fix #77973: Uninitialized read in gdImageCreateFromXbm
2019-05-27 16:49:19 -07:00
Stanislav Malyshev
7cf7148a8f Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow 2019-05-27 16:32:42 -07:00
Peter Kokot
fee9e43892 Merge branch 'PHP-7.4'
* PHP-7.4:
  Use *.data for tests data files
2019-05-17 19:05:16 +02:00
Peter Kokot
83bfbc2903 Use *.data for tests data files 2019-05-17 19:04:43 +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
Peter Kokot
a3c88135d4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove unused variables
2019-05-10 22:58:29 +02:00
Peter Kokot
313930a36a Remove unused variables 2019-05-10 22:58:14 +02:00
Nikita Popov
f9e918b17d Merge branch 'PHP-7.4' 2019-04-17 14:25:34 +02:00
Nikita Popov
487d4d07b4 Remove some uses of deprecated internal_encoding settings in tests 2019-04-17 14:24:11 +02:00
Nikita Popov
1d53d6df7e Merge branch 'PHP-7.4' 2019-04-17 14:06:05 +02:00
Nikita Popov
f73f190c3f Fix internal_encoding fallback in mbstring
By introducing a hook that is called whenever one of
internal_encoding / input_encoding / output_encoding changes, so
that mbstring can adjust it's internal state.

This also makes internal_encoding work with zend multibyte.
2019-04-17 14:05:53 +02:00
Nikita Popov
1b41961636 Remove dubious memcmp optimization in iconv
This violates strict aliasing, and appears entirely unnecessary --
the compiler can optimize fixed size memcmp's by itself.
2019-04-12 15:12:45 +02:00
Nikita Popov
4b1491a7b1 Remove dubious memcmp optimization in iconv
This violates strict aliasing, and appears entirely unnecessary --
the compiler can optimize fixed size memcmp's by itself.
2019-04-12 15:12:39 +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
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
824efb726c Merge branch 'PHP-7.4' 2019-03-05 17:10:26 +01:00
Nikita Popov
10b4113638 Remove more zpp error tests 2019-03-05 17:09:09 +01:00
Nikita Popov
2f1f34952e Remove $errcontext argument to error handlers
I'm removing the argument entirely here, but we might want to change
this to passing null or and empty array instead, if the impact of
dropping it entirely turns out to be too large.

This was deprecated as part of https://wiki.php.net/rfc/deprecations_php_7_2
as a doc-only deprecation.
2019-02-05 14:12:10 +01:00
Nikita Popov
8bc663f43b Remove zpp variation tests 2019-02-05 09:38:55 +01:00
Peter Kokot
92ac598aab Remove local variables
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.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Christoph M. Becker
22889c94d1 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #77147: Fix for 60494 ignores ICONV_MIME_DECODE_CONTINUE_ON_ERROR
2018-11-14 14:59:56 +01:00
Christoph M. Becker
9a2bd2f453 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77147: Fix for 60494 ignores ICONV_MIME_DECODE_CONTINUE_ON_ERROR
2018-11-14 14:59:30 +01:00
Christoph M. Becker
211c6189f6 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #77147: Fix for 60494 ignores ICONV_MIME_DECODE_CONTINUE_ON_ERROR
2018-11-14 14:57:40 +01:00
Christoph M. Becker
a56cdd0a82 Fix #77147: Fix for 60494 ignores ICONV_MIME_DECODE_CONTINUE_ON_ERROR
If the `ICONV_MIME_DECODE_CONTINUE_ON_ERROR` flag is set, parsing
should not fail, if there are illegal characters in the headers;
instead we silently ignore these like before.
2018-11-14 14:55:38 +01:00
Peter Kokot
787dfd0909 Remove unused test.inc in ext/iconv/tests 2018-10-15 17:57:22 +02:00
Peter Kokot
d679f02295 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:33:09 +02:00
Peter Kokot
b746e69887 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:32:30 +02:00
Peter Kokot
f1d7e3ca0b Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:31:31 +02:00
Peter Kokot
113213f027 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:29:24 +02:00
Peter Kokot
d7a3edd45d Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
Peter Kokot
782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Peter Kokot
17ccbeec32 Trim trailing whitespace in *.phpt 2018-10-14 19:44:14 +02:00
Peter Kokot
7af945e271 Trim trailing whitespace in *.phpt 2018-10-14 19:43:12 +02:00
Gabriel Caruso
9c144e0d82
Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
Peter Kokot
1ad08256f3 Sync leading and final newlines in source code files
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-14 12:56:38 +02:00
Peter Kokot
1c850bfcca Sync leading and final newlines in source code files
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-14 12:55:24 +02:00
Peter Kokot
60a69daec6 Sync leading and final newlines in source code files
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-14 12:54:08 +02:00
Peter Kokot
03f3b8479b Sync leading and final newlines in source code files
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-14 12:51:01 +02:00
Peter Kokot
37c329d715 Trim trailing whitespace in source code files 2018-10-13 14:17:28 +02:00
Peter Kokot
3362620b5f Trim trailing whitespace in source code files 2018-10-13 14:16:33 +02:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Peter Kokot
7f6387b59a Trim trailing whitespace in source code files 2018-10-13 14:12:55 +02:00
Christoph M. Becker
7022f3a34f Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #66828: iconv_mime_encode Q-encoding longer than it should be
2018-09-22 15:57:28 +02:00
Christoph M. Becker
150e2b8c8c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #66828: iconv_mime_encode Q-encoding longer than it should be
2018-09-22 15:56:49 +02:00
Christoph M. Becker
7c2cc9aa56 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #66828: iconv_mime_encode Q-encoding longer than it should be
2018-09-22 15:31:02 +02:00
Christoph M. Becker
9cbe1283f7 Fix #66828: iconv_mime_encode Q-encoding longer than it should be
Before the fix for bug 48289 has been applied, the algorithm to
construct a Q-encoded-word has been optimistic, i.e. try to encode as
many bytes that *may* fit in the remaining space, calculate the actual
length of the Q-encoded word, and if it's too long, try again with a
reduced size.  However, the fix for the mentioned bug replaced this by
a pessimistic algorithm, which always terminates[1] the for loop[2]
during the first iteration (which renders the following 3 lines as dead
code), and as such easily produces unnecessarily short encoded-words.
Instead the proper fix for the bug would have been to make sure that
`out_size` is always decremented, if the space isn't sufficient for the
encoded-word.

[1] <https://github.com/php/php-src/blob/php-7.3.0beta3/ext/iconv/iconv.c#L1421>
[2] <https://github.com/php/php-src/blob/php-7.3.0beta3/ext/iconv/iconv.c#L1360>
2018-09-22 15:20:20 +02:00
Peter Kokot
7dd62811ce Remove HAVE_STDLIB_H
The C89 and later standard defines the `<stdlib.h>` header as part of
the standard headers [1] and on current systems it is always present
and the `HAVE_STDLIB_H` symbol can be removed.

Also Autoconf suggests doing this and relying on C89 or above [2] and [3].

[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
[2] http://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
[3] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/autoconf.html
2018-09-16 20:53:53 +02:00
Nikita Popov
153e292e10 Escape trigraph sequence
??= is a trigraph for #, so it needs to be escaped. To stay
consistent I'm escaping all question marks in this literal, even
though one of the latter two would suffice.
2018-09-04 05:07:43 +02:00
Christoph M. Becker
4d6b0b5031 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #68180: iconv_mime_decode can return extra characters in a header
2018-08-26 13:23:51 +02:00
Christoph M. Becker
20849b0b0f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #68180: iconv_mime_decode can return extra characters in a header
2018-08-26 13:21:22 +02:00
Christoph M. Becker
efb86aef12 Fix #68180: iconv_mime_decode can return extra characters in a header
Basically, the algorithm to append a converted string to an existing
`smart_str` works by increasing the `smart_str` buffer, to let `iconv`
convert characters until there is no more space, to set the new length
of the `smart_str` and to repeat until there is no more input.

Formerly, the new length calculation has been wrong, though, since we
would have to take the old `out_len` into account (`buf_growth -
old_out_len - out_len`).  However, since there is no need to take the
old `out_len` into account when increasing the `smart_str` buffer, we
can simplify the fix, avoiding an additional variable.
2018-08-26 13:18:35 +02:00
Christoph M. Becker
b5afc99afb Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #60494: iconv_mime_decode does ignore special characters
2018-08-25 17:52:16 +02:00
Christoph M. Becker
314b8ecf8b Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #60494: iconv_mime_decode does ignore special characters
2018-08-25 17:47:29 +02:00
Christoph M. Becker
e29c946c29 Fix #60494: iconv_mime_decode does ignore special characters
We must not ignore erroneous characters in mime headers, but rather let
iconv_mime_decode() fail in this case, issuing the usual notice
regarding illegal characters.
2018-08-25 17:40:39 +02:00
Christoph M. Becker
065eee16b5 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #63839: iconv_mime_decode_headers function is skipping headers
2018-08-25 14:54:32 +02:00
Christoph M. Becker
7e176ddb57 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #63839: iconv_mime_decode_headers function is skipping headers
2018-08-25 14:52:54 +02:00
Christoph M. Becker
8754d44167 Fix #63839: iconv_mime_decode_headers function is skipping headers
We have to cater to the possibility that `=?` is not the start of an
encoded-word, but rather a literal `=?`.  If a line break is found
while we're still looking for the charset, we can safely assume that
it's a literal `=?`, and act accordingly.
2018-08-25 14:51:13 +02:00
Christoph M. Becker
50fec3be0e Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #55146: iconv_mime_decode_headers() skips some headers
2018-08-25 14:43:13 +02:00
Christoph M. Becker
6922cae4ae Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #55146: iconv_mime_decode_headers() skips some headers
2018-08-25 14:41:38 +02:00
Christoph M. Becker
6e1980e152 Fix #55146: iconv_mime_decode_headers() skips some headers
If we're expecting the start of an encoded word (`=?`), but instead of
the question mark get a line break (CR or LF), we must not append it to
the `pretval`.
2018-08-25 14:40:07 +02:00
Christoph M. Becker
eb03290754 Fix #53891: iconv_mime_encode() fails to Q-encode UTF-8 string
The minimum length of an encoded-word is actually the pure encoding
overhead plus the length of the `output-charset` plus the minimum unit
of encoded text, which is 4 for B-encoding and (for simplicity) 3 for
Q-encoding.  We also cater to the possibility that we need further
encoded words, which would be split by the `line-break-chars` followed
by a space character.  Obviously, the former `out_charset_len + 12` is
too simplistic and wrong in the given case (where the magic number
would be 13).

These simplifications are somewhat wasteful, but iconv_mime_encode()
with Q-encoding is wasteful anyway (see bug 66828[1]), and the proper
solution to convert the whole input to the desired output charset
upfront, and applying the encoding afterwards appears too much a change
for the stable releases.

[1] <https://bugs.php.net/66828>
2018-08-25 14:30:07 +02:00
Peter Kokot
f2e4de8b56 Fix AC_RUN_IFELSE calls when cross-compiling
AC_RUN_IFELSE program can't be run when cross-compiling. This fix removes
warnings given by autotools scripts.
2018-07-30 06:38:59 +02:00
Peter Kokot
4371945b8b Replace obsolete AC_TRY_FOO with AC_FOO_IFELSE
Autoconf 2.50 released in 2001 made several macros obsolete including
the AC_TRY_RUN, AC_TRY_COMPILE and AC_TRY_LINK:
http://git.savannah.gnu.org/cgit/autoconf.git/tree/ChangeLog.2

These macros should be replaced with the current AC_FOO_IFELSE instead:
- AC_TRY_RUN with AC_RUN_IFELSE and AC_LANG_SOURCE
- AC_TRY_LINK with AC_LINK_IFELSE and AC_LANG_PROGRAM
- AC_TRY_COMPILE with AC_COMPILE_IFELSE and AC_LANG_PROGRAM

PHP 5.4 to 7.1 require Autoconf 2.59+ version, PHP 7.2 and above require
2.64+ version, and the PHP 7.2 phpize script requires 2.59+ version which
are all greater than above mentioned 2.50 version therefore systems
should be well supported by now.

This patch was created with the help of autoupdate script:
autoupdate <file>

Reference docs:
- https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html
- https://www.gnu.org/software/autoconf/manual/autoconf-2.59/autoconf.pdf
2018-07-30 02:36:38 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
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.
2018-07-25 00:53:25 +02:00
Gabriel Caruso
c93aba042f
Give a reason why the test was skipped
This will help us debug why a test was skipped in GCOV
(http://gcov.php.net/viewer.php?version=PHP_HEAD&func=skip), and maybe
put them to run again
2018-07-22 16:41:41 -03:00
Dmitry Stogov
4a475a4976 Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
2018-07-04 19:22:24 +03:00
Peter Kokot
5651b1a7ca Remove Git ident attribute from the iconv extension 2018-06-16 12:49:55 +02:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov
524f5245c5 Avoid useless checks, using zend_string_efree(), in cases where the string is known to be a temporary allocated zend_string. 2018-05-08 17:30:15 +03:00
Anatol Belski
1de1c86688 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix test portability
2018-04-24 10:49:34 +02:00
Anatol Belski
1df43a086f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test portability
2018-04-24 10:49:15 +02:00