]> granicus.if.org Git - php/log
php
4 years agoMerge branch 'PHP-7.4' into master
Christoph M. Becker [Mon, 28 Sep 2020 20:59:51 +0000 (22:59 +0200)]
Merge branch 'PHP-7.4' into master

* PHP-7.4:
  Fix #67465: NULL Pointer dereference in odbc_handle_preparer

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Mon, 28 Sep 2020 20:57:59 +0000 (22:57 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #67465: NULL Pointer dereference in odbc_handle_preparer

4 years agoFix #67465: NULL Pointer dereference in odbc_handle_preparer
Christoph M. Becker [Mon, 28 Sep 2020 15:05:17 +0000 (17:05 +0200)]
Fix #67465: NULL Pointer dereference in odbc_handle_preparer

We have to initialize `stmt->driver_data` before we use it.

Closes GH-6225.

4 years agoMove invariant type guard out of loop
Dmitry Stogov [Mon, 28 Sep 2020 20:54:28 +0000 (23:54 +0300)]
Move invariant type guard out of loop

4 years agoAnother pass making some failure states unconditional erros in PDO
George Peter Banyard [Mon, 28 Sep 2020 18:35:31 +0000 (19:35 +0100)]
Another pass making some failure states unconditional erros in PDO

Also make internal function return type more accurate to inform usage

4 years agoMake various failure conditions in PDO unconditional errors
George Peter Banyard [Thu, 24 Sep 2020 23:41:21 +0000 (00:41 +0100)]
Make various failure conditions in PDO unconditional errors

This includes TypeErrors, ValueErrors, Error for uninitialized objects
and invalid user classes/callable instanciation

Closes GH-6212

4 years agoDo not register quoter handler in ODBC
George Peter Banyard [Mon, 28 Sep 2020 16:44:13 +0000 (17:44 +0100)]
Do not register quoter handler in ODBC

This functionallity is not (yet) implemented and therefore gives a bogus error while using PDO

4 years agoDrop ZPP check in PDO MySQLi test
George Peter Banyard [Fri, 25 Sep 2020 01:43:44 +0000 (02:43 +0100)]
Drop ZPP check in PDO MySQLi test

This test is marked as XFAIL so it doesn't get looked at.

It checks that the method is called without arguments which is a ZPP concern

4 years agoDump class names
Dmitry Stogov [Mon, 28 Sep 2020 17:29:46 +0000 (20:29 +0300)]
Dump class names

4 years agoPromote notice to ValueError for invalid hint key
George Peter Banyard [Mon, 28 Sep 2020 14:14:44 +0000 (15:14 +0100)]
Promote notice to ValueError for invalid hint key

4 years agoImproved trace selection rules
Dmitry Stogov [Mon, 28 Sep 2020 14:04:34 +0000 (17:04 +0300)]
Improved trace selection rules

4 years agoPromote warnings in ext/xsl
Nikita Popov [Mon, 28 Sep 2020 13:55:22 +0000 (15:55 +0200)]
Promote warnings in ext/xsl

4 years agoRemove unused XSL_DOMOBJ_NEW() macro
Nikita Popov [Mon, 28 Sep 2020 13:41:31 +0000 (15:41 +0200)]
Remove unused XSL_DOMOBJ_NEW() macro

And inline the XSL_REGISTER_CLASS() macro.

4 years agoFixed usage of invalid frame for exit point
Dmitry Stogov [Mon, 28 Sep 2020 13:18:06 +0000 (16:18 +0300)]
Fixed usage of invalid frame for exit point

4 years agoConsistently handle out of bounds offsets in iconv_strpos()
Nikita Popov [Mon, 28 Sep 2020 11:11:07 +0000 (13:11 +0200)]
Consistently handle out of bounds offsets in iconv_strpos()

Same as in all other strpos() style functions, throw ValueError on
out of bounds offset.

4 years agoExtensions should have the final say on their compiler flags
George Peter Banyard [Thu, 24 Sep 2020 12:28:56 +0000 (13:28 +0100)]
Extensions should have the final say on their compiler flags

Currently compiler flags passed by extensions using the standard
``PHP_NEW_EXTENSION`` and ``PHP_ADD_SOURCES`` m4 macros are prepended
before the ones defined by ``Zend/Zend.m4``.

This was not really an issue before as ``Zend.m4`` only included
``-Wall`` but since the addition of ``-Wextra`` various issue about
disabling flags have been brought up.

A preliminary attempt was done in commit 5c1cf7669b937dcb4589cb0c8deccd343dfd85f9
but this turns out to be more or less irrelevant.

The root issue is that  ``PHP_NEW_EXTENSION`` and ``PHP_ADD_SOURCES`` call the
``PHP_ADD_SOURCES_X`` macro and pass their flags as the 3rd argument which prepends
the flags. There exists a 6th argument for this macro which appends them but from a
cursory look at https://heap.space/search?full=PHP_ADD_SOURCES_X&project=php-src
this is not used. Moreover, the comment describing this macro explicitly informs
that this macro should not be used directly.

As such we drop the 6th argument of ``PHP_ADD_SOURCES_X`` and move the `special-flags`
argument to be appended instead of prepended.

Closes GH-6204

4 years agoSimplify iconv_strpos implementation
Nikita Popov [Mon, 28 Sep 2020 12:15:04 +0000 (14:15 +0200)]
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.

4 years agoMissed opline guard
Dmitry Stogov [Mon, 28 Sep 2020 11:47:45 +0000 (14:47 +0300)]
Missed opline guard

4 years agoThrow warning for invalid iconv charset
Nikita Popov [Mon, 28 Sep 2020 10:51:03 +0000 (12:51 +0200)]
Throw warning for invalid iconv charset

4 years agoSkip one more imap test under asan
Nikita Popov [Mon, 28 Sep 2020 07:54:44 +0000 (09:54 +0200)]
Skip one more imap test under asan

Wondering if the error just moves to a different test each time
we skip one?

4 years agoUpdate mbstring parameter names
Nikita Popov [Thu, 24 Sep 2020 14:14:26 +0000 (16:14 +0200)]
Update mbstring parameter names

Closes GH-6207.

4 years agoFixed test for MySQL < 5.6
Matteo Beccati [Mon, 28 Sep 2020 06:52:21 +0000 (08:52 +0200)]
Fixed test for MySQL < 5.6

Refs GH-6172.

4 years agoMake mysqli_warning constructor private
Nikita Popov [Thu, 24 Sep 2020 14:51:47 +0000 (16:51 +0200)]
Make mysqli_warning constructor private

The constructor was already effectively inaccessible (protected
on a final class). This just makes it more obvious and removes
the implementation in favor of directly throwing.

Per the removed test, this was an unfinished feature, and I don't
think it makes a lot of sense to finish it -- the
mysqli_stmt::get_warnings() interface makes more sense than
direct construction.

Closes GH-6208.

4 years agoRename mysqli parameters to be more logical
Larry Garfield [Sun, 20 Sep 2020 00:57:53 +0000 (19:57 -0500)]
Rename mysqli parameters to be more logical

Closes GH-6172.

4 years agoClean up spl_fixedarray.c
Levi Morrison [Sun, 27 Sep 2020 17:17:17 +0000 (11:17 -0600)]
Clean up spl_fixedarray.c

Remove inline.
Remove old folding blocks.
Convert an int usage to bool.

Convert some uses of int and size_t into zend_long. This is
incomplete because get_gc requires `int *n`, which should probably
become zend_long or size_t eventually.

Adds spl_fixedarray_empty to help enforce invariants.
Adds spl_fixedarray_default_ctor.
Documents some functions.

Reworks spl_fixedarray_copy into two functions:
  - spl_fixedarray_copy_ctor
  - spl_fixedarray_copy_range

I'm hoping to eventually export SplFixedArray for extensions to
use directly, which is the motivation here.

4 years agoAllow attributes to be applied to property/constant groups
Nikita Popov [Tue, 22 Sep 2020 12:44:06 +0000 (14:44 +0200)]
Allow attributes to be applied to property/constant groups

Remove arbitrary restriction that attributes cannot be applied
to property/constant groups.

The attribute applies to all elements of the group, just like
modifiers and types do.

See also https://externals.io/message/111914.

Closes GH-6186.

4 years agoMake constexpr compilation robust against multiple compilation
Nikita Popov [Sun, 27 Sep 2020 09:21:52 +0000 (11:21 +0200)]
Make constexpr compilation robust against multiple compilation

Instead of setting the old AST type to zero, replace the AST with
the compiled constexpr AST zval. This requires passing in a
zend_ast** instead of a zend_ast*.

This allows compiling ASTs containing constexprs multiple times
-- the second time, the existing compiled representation will be
resused.

This means we no longer need to copy the attributes AST for
promoted properties.

4 years agoHonor strict_types=1 for attributes, improve backtraces
Nikita Popov [Wed, 23 Sep 2020 11:01:07 +0000 (13:01 +0200)]
Honor strict_types=1 for attributes, improve backtraces

Make ReflectionAttribute::newInstance() respect the strict_types=1
declaration at the attribute use-site. More generally, pretend that
we are calling the attribute constructor from the place where the
attribute is used, which also means that the attribute location will
show up properly in backtraces and inside "called in" error information.

This requires us to store the attributes strict_types scope (as flags),
as well as the attribute line number. The attribute filename can be
recovered from the symbol it is used on. We might want to expose the
attribute line number via reflection as well.

See also https://externals.io/message/111915.

Closes GH-6201.

4 years agoSkip test with ICU version < 58
Matteo Beccati [Sat, 26 Sep 2020 08:47:56 +0000 (10:47 +0200)]
Skip test with ICU version < 58

4 years agoPass zend_execute_data instead of zend_function to fcall init
Sammy Kaye Powers [Thu, 24 Sep 2020 19:57:43 +0000 (12:57 -0700)]
Pass zend_execute_data instead of zend_function to fcall init

The motivation for this change is to prevent extensions from having to check executor globals for the current execute_data during function call init. A previous implementation of the observer API initialized the function call from runtime cache initialization before execute_data was allocated which is why zend_function was passed in.

But now that the observer API is implemented via opcode specialization, it makes sense to pass in the execute_data. This also keeps the API a bit more consistent for existing extensions that already hook zend_execute_ex.

Closes GH-6209

4 years agoPromote warning to ValueError for Spoofchecker::setRestrictionLevel()
George Peter Banyard [Wed, 23 Sep 2020 16:02:43 +0000 (17:02 +0100)]
Promote warning to ValueError for Spoofchecker::setRestrictionLevel()

Closes GH-6197

4 years agoMerge branch 'PHP-7.4'
George Peter Banyard [Fri, 25 Sep 2020 15:35:50 +0000 (16:35 +0100)]
Merge branch 'PHP-7.4'

* PHP-7.4:
  Fix logic error in PDO

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
George Peter Banyard [Fri, 25 Sep 2020 15:32:41 +0000 (16:32 +0100)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix logic error in PDO

4 years agoFix logic error in PDO
George Peter Banyard [Fri, 25 Sep 2020 13:54:25 +0000 (14:54 +0100)]
Fix logic error in PDO

4 years agoInverse logic in do_fetch() to reduce a level of indentation
George Peter Banyard [Fri, 25 Sep 2020 03:05:53 +0000 (04:05 +0100)]
Inverse logic in do_fetch() to reduce a level of indentation

4 years agoDrop do_bind argument in do_fetch(_common)() in PDO
George Peter Banyard [Fri, 25 Sep 2020 02:55:18 +0000 (03:55 +0100)]
Drop do_bind argument in do_fetch(_common)() in PDO

It is always set to true by callers and therefore irrelevant.

4 years agoUse callable type in register_shutdown_function()
Nikita Popov [Fri, 25 Sep 2020 12:47:10 +0000 (14:47 +0200)]
Use callable type in register_shutdown_function()

To make things a bit less weird, split off the function name into
a zval stored separately from the arguments. This allows us to
use normal zpp and get standard behavior.

4 years agoMerge branch 'PHP-7.4' into master
Christoph M. Becker [Fri, 25 Sep 2020 11:53:19 +0000 (13:53 +0200)]
Merge branch 'PHP-7.4' into master

* PHP-7.4:
  Fix #80147: BINARY strings may not be properly zero-terminated

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Fri, 25 Sep 2020 11:51:55 +0000 (13:51 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #80147: BINARY strings may not be properly zero-terminated

4 years agoFix #80147: BINARY strings may not be properly zero-terminated
Christoph M. Becker [Fri, 25 Sep 2020 09:25:02 +0000 (11:25 +0200)]
Fix #80147: BINARY strings may not be properly zero-terminated

We have to manually ensure that all strings fetched from a data source
are zero-terminated.

Closes GH-6213.

4 years agoRename $qualifier/$owner params to $catalog/$schema
Christoph M. Becker [Thu, 24 Sep 2020 21:19:15 +0000 (23:19 +0200)]
Rename $qualifier/$owner params to $catalog/$schema

These have been called qualifier and owner with ODBC 2, but ODBC 3
changed that to catalog and schema, respectively.

Closes GH-6210.

4 years agoAdd proper count() parameter type
Nikita Popov [Fri, 25 Sep 2020 10:31:05 +0000 (12:31 +0200)]
Add proper count() parameter type

We can make this Countable|array now.

4 years agoPromote a few forgotten warnings to exceptions
Máté Kocsis [Fri, 25 Sep 2020 08:18:12 +0000 (10:18 +0200)]
Promote a few forgotten warnings to exceptions

Closes GH-6211

4 years agoUpdate ext/odbc stub hash
Máté Kocsis [Fri, 25 Sep 2020 09:19:50 +0000 (11:19 +0200)]
Update ext/odbc stub hash

4 years agoImprove parameter names in ext/curl
Máté Kocsis [Thu, 17 Sep 2020 18:15:01 +0000 (20:15 +0200)]
Improve parameter names in ext/curl

Closes GH-6155

4 years agoUnify 32-bit/64-bit str_split tests
Nikita Popov [Fri, 25 Sep 2020 08:03:41 +0000 (10:03 +0200)]
Unify 32-bit/64-bit str_split tests

The 32-bit tests work on both 32-bit and 64-bit. I dropped the
64-bit variants as they only test one additional case that I don't
think adds particular value.

4 years agoNormalize substr() behavior
Nikita Popov [Tue, 22 Sep 2020 07:56:08 +0000 (09:56 +0200)]
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.

4 years agoFix #64937: Firebird PDO preprocessing sql
Simonov Denis [Wed, 18 Dec 2019 19:42:07 +0000 (20:42 +0100)]
Fix #64937: Firebird PDO preprocessing sql

This patch fixes some problems with preprocessing SQL queries.

* The new algorithm takes into account single-line and multi-line
  comments and ignores the ":" and "?" Parameter markers in them.

* The algorithm allows the EXECUTE BLOCK statement to be processed
  correctly. For this statement, it is necessary to search for
  parameter markers between EXECUTE BLOCK and AS, the rest should be
  left as is.

The SQL preprocessing code has been ported from Firebird to handle
EXECUTE STATEMENT.

Closes GH-4920.

4 years agoRemove outdated link to bug report
Christoph M. Becker [Thu, 24 Sep 2020 21:20:29 +0000 (23:20 +0200)]
Remove outdated link to bug report

That bug has been fixed, so no need to keep that link any longer.

4 years agoFix UNKNOWN default values in ext/odbc
Máté Kocsis [Thu, 17 Sep 2020 17:35:40 +0000 (19:35 +0200)]
Fix UNKNOWN default values in ext/odbc

Closes GH-6154

4 years agoImprove parameter names in ext/hash and ext/openssl
Máté Kocsis [Thu, 17 Sep 2020 18:39:21 +0000 (20:39 +0200)]
Improve parameter names in ext/hash and ext/openssl

Closes GH-6156

4 years agoUpdate fileinfo parameter names
Nikita Popov [Thu, 24 Sep 2020 13:37:10 +0000 (15:37 +0200)]
Update fileinfo parameter names

Closes GH-6206.

4 years agoMerge branch 'PHP-7.4' into master
Christoph M. Becker [Thu, 24 Sep 2020 15:14:22 +0000 (17:14 +0200)]
Merge branch 'PHP-7.4' into master

* PHP-7.4:
  Use proper skipif section

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Thu, 24 Sep 2020 15:13:01 +0000 (17:13 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Use proper skipif section

4 years agoUse proper skipif section
Christoph M. Becker [Thu, 24 Sep 2020 15:10:09 +0000 (17:10 +0200)]
Use proper skipif section

The ODBC tests have to be skipped if no connection to the server can be
established.

4 years agoSkip imap_lsub_basic.phpt under asan
Nikita Popov [Thu, 24 Sep 2020 15:03:53 +0000 (17:03 +0200)]
Skip imap_lsub_basic.phpt under asan

LeakSanitizer fails on Azure with:

> Tracer caught signal 11: addr=0x0 pc=0x7f86cde7c8b0 sp=0x7f86c46bcce0

4 years agoAdd option to print parameter name stats to gen_stub
Nikita Popov [Thu, 24 Sep 2020 13:16:07 +0000 (15:16 +0200)]
Add option to print parameter name stats to gen_stub

4 years agoMerge branch 'PHP-7.4' into master
Christoph M. Becker [Thu, 24 Sep 2020 10:23:08 +0000 (12:23 +0200)]
Merge branch 'PHP-7.4' into master

* PHP-7.4:
  Fix #78470: odbc_specialcolumns() no longer accepts $nullable

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Thu, 24 Sep 2020 10:16:34 +0000 (12:16 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #78470: odbc_specialcolumns() no longer accepts $nullable

4 years agoFix #78470: odbc_specialcolumns() no longer accepts $nullable
Christoph M. Becker [Thu, 24 Sep 2020 08:30:41 +0000 (10:30 +0200)]
Fix #78470: odbc_specialcolumns() no longer accepts $nullable

It is mandatory to pass either `SQL_NO_NULLS` or `SQL_NULLABLE` as
tenth parameter to `SQLSpecialColumns()`; otherwise the function call
fails.  Therefore the user must be allowed to pass the desired value
as parameter to `odbc_specialcolumns()` again.

Closes GH-6200.

4 years agoFix test for cases where data sources are available
Christoph M. Becker [Thu, 24 Sep 2020 09:23:20 +0000 (11:23 +0200)]
Fix test for cases where data sources are available

That `bool(false)` is a relict of adapting the test expectations to the
warning promotions.

4 years agoSkip unnecessary unknown() frames
Nikita Popov [Wed, 23 Sep 2020 15:06:28 +0000 (17:06 +0200)]
Skip unnecessary unknown() frames

Noticed this while working on attributes strict_types handling.
We sometimes insert dummy frames internally, but I don't think
these should show up in debug_backtrace output unless they're
needed, either to display an include call or to preserve file/line
information that would otherwise get lost.

Closes GH-6195.

4 years agoMore precise type in mysqli_result constructor
Nikita Popov [Thu, 24 Sep 2020 07:54:59 +0000 (09:54 +0200)]
More precise type in mysqli_result constructor

This ctor requires a mysqli object. Possibly there was some
confusion with the mysqli_warning constructor here.

4 years agoClear error flag instead of toggling it
Christoph M. Becker [Wed, 23 Sep 2020 09:37:14 +0000 (11:37 +0200)]
Clear error flag instead of toggling it

The toggling of the `REPORT_ERRORS` looks fishy, and likely was
intented as clearing.

Closes GH-6190.

4 years agoImprove trace selection (avoid blacklisting of trace that may be linked).
Dmitry Stogov [Wed, 23 Sep 2020 20:50:44 +0000 (23:50 +0300)]
Improve trace selection (avoid blacklisting of trace that may be linked).

4 years agoPromote warnings to Error in IMAP extension
George Peter Banyard [Thu, 17 Sep 2020 15:22:01 +0000 (17:22 +0200)]
Promote warnings to Error in IMAP extension

Drop some dependencies on argc at the same time

Closes GH-6164

4 years agoReplace ZEND_JIT_TRACE_STOP_RETURN_HALT and ZEND_JIT_TRACE_STOP_HALT by separate...
Dmitry Stogov [Wed, 23 Sep 2020 12:44:04 +0000 (15:44 +0300)]
Replace ZEND_JIT_TRACE_STOP_RETURN_HALT and ZEND_JIT_TRACE_STOP_HALT by separate ZEND_JIT_TRACE_HALT flag.

4 years agoRemove unused --temp-urlbase option from run-tests.php
Nikita Popov [Wed, 23 Sep 2020 10:34:19 +0000 (12:34 +0200)]
Remove unused --temp-urlbase option from run-tests.php

This was part of the removed HTML functionality.

4 years agoFix #80139: copy_variation5.phpt fails when run on bind mount
Christoph M. Becker [Wed, 23 Sep 2020 10:13:35 +0000 (12:13 +0200)]
Fix #80139: copy_variation5.phpt fails when run on bind mount

This test case is not supposed to run on case-insensitive file system;
just checking for macOS/Windows doesn't cut it.

4 years agoImprove PDO::inTransaction() support for MySQL
twosee [Tue, 10 Dec 2019 06:55:10 +0000 (14:55 +0800)]
Improve PDO::inTransaction() support for MySQL

Closes GH-4996.

4 years agoClean up file created during testing
Christoph M. Becker [Wed, 23 Sep 2020 09:44:32 +0000 (11:44 +0200)]
Clean up file created during testing

4 years agoFix test case
Christoph M. Becker [Wed, 23 Sep 2020 09:20:30 +0000 (11:20 +0200)]
Fix test case

4 years agoMerge branch 'PHP-7.4' into master
Christoph M. Becker [Wed, 23 Sep 2020 09:14:06 +0000 (11:14 +0200)]
Merge branch 'PHP-7.4' into master

* PHP-7.4:
  Fix #76735: Incorrect message in fopen on invalid mode

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Wed, 23 Sep 2020 08:54:40 +0000 (10:54 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #76735: Incorrect message in fopen on invalid mode

4 years agoFix #76735: Incorrect message in fopen on invalid mode
Christoph M. Becker [Tue, 22 Sep 2020 16:57:21 +0000 (18:57 +0200)]
Fix #76735: Incorrect message in fopen on invalid mode

We have to log errors in `stream_opener` callbacks to the wrapper's
error log, because otherwise we may pick up an unrelated `errno` or a
most generic message.

Closes GH-6187.

4 years agoMerge branch 'PHP-7.4' into master
Christoph M. Becker [Wed, 23 Sep 2020 08:48:35 +0000 (10:48 +0200)]
Merge branch 'PHP-7.4' into master

* PHP-7.4:
  Fix #77493: curl_basic_009 fails with newer curl versions

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Wed, 23 Sep 2020 08:44:06 +0000 (10:44 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #77493: curl_basic_009 fails with newer curl versions

4 years agoFix #77493: curl_basic_009 fails with newer curl versions
Christoph M. Becker [Wed, 23 Sep 2020 08:38:59 +0000 (10:38 +0200)]
Fix #77493: curl_basic_009 fails with newer curl versions

libcurl 7.62.0 introduced a maximum protocol length of 8, so this test
case failed with `CURLE_URL_MALFORMAT`.  While this is lifted to 40 as
of libcurl 7.65.0, and this test case has already been fixed with
commit e27301c[1], we restore the original intention to check for a
`CURLE_UNSUPPORTED_PROTOCOL ` error.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=e27301c7b37f6a1643a0dc1966919bd62a32bc74>

4 years agoConsistent error handling for fgetcsv/fputcsv
Nikita Popov [Tue, 22 Sep 2020 14:07:31 +0000 (16:07 +0200)]
Consistent error handling for fgetcsv/fputcsv

Normalize the behavior between the file functions and those on
SplFileObject.

Be consistent about throwing regardless of whether the delimiter etc
is empty or has too many characters. I don't think it's worthwhile
to distinguish these cases.

Back when we looked into this originally, there was some hope that
we might want to add support for multiple-character delimiter etc,
but after a cursory look, I really don't think this is going to
happen (for fputcsv maybe, but for fgetcsv this just makes an already
broken function much more complicated.)

Closes GH-6188.

4 years agoFix a few ZEND_UNREACHABLE() calls
Máté Kocsis [Wed, 23 Sep 2020 07:56:19 +0000 (09:56 +0200)]
Fix a few ZEND_UNREACHABLE() calls

4 years agoFix shift ub
Nikita Popov [Wed, 23 Sep 2020 08:04:32 +0000 (10:04 +0200)]
Fix shift ub

And typo in macro name

4 years agofor consistency use for all *Name methods
Remi Collet [Wed, 23 Sep 2020 07:31:44 +0000 (09:31 +0200)]
for consistency use  for all *Name methods

4 years agoSplFixedArray is Aggregate, not Iterable
Alex Dowad [Mon, 11 May 2020 18:32:13 +0000 (20:32 +0200)]
SplFixedArray is Aggregate, not Iterable

One strange feature of SplFixedArray was that it could not be used in nested foreach
loops. If one did so, the inner loop would overwrite the iteration state of the outer
loop.

To illustrate:

    $spl = SplFixedArray::fromArray([0, 1]);
    foreach ($spl as $a) {
      foreach ($spl as $b) {
        echo "$a $b";
      }
    }

Would only print two lines:

    0 0
    0 1

Use the new InternalIterator feature which was introduced in ff19ec2df3 to convert
SplFixedArray to an Aggregate rather than Iterable. As a bonus, we get to trim down
some ugly code! Yay!

4 years agoTweak some macro definition on Windows
George Peter Banyard [Wed, 20 May 2020 17:35:39 +0000 (19:35 +0200)]
Tweak some macro definition on Windows

Closes GH-5606

4 years agoFix double free on unpack error
Nikita Popov [Tue, 22 Sep 2020 21:31:56 +0000 (23:31 +0200)]
Fix double free on unpack error

4 years agoFix extra args leak
Dmitry Stogov [Tue, 22 Sep 2020 21:21:39 +0000 (00:21 +0300)]
Fix extra args leak

4 years agoPromote warnings to error in DOM extension
George Peter Banyard [Sun, 19 Apr 2020 12:35:25 +0000 (14:35 +0200)]
Promote warnings to error in DOM extension

Closes GH-5418

4 years agoDrop usage of E_RECOVERABLE_ERROR in Session extension
George Peter Banyard [Tue, 22 Sep 2020 17:32:21 +0000 (18:32 +0100)]
Drop usage of E_RECOVERABLE_ERROR in Session extension

4 years agoAdd proper default values for optional arguments in IMAP
George Peter Banyard [Mon, 21 Sep 2020 15:19:10 +0000 (16:19 +0100)]
Add proper default values for optional arguments in IMAP

Closes GH-6179

4 years agoRefactor imap_mail()'s internal implementation to use zend_strings
George Peter Banyard [Mon, 21 Sep 2020 15:11:18 +0000 (16:11 +0100)]
Refactor imap_mail()'s internal implementation to use zend_strings

4 years agoTry to fix test
Nikita Popov [Tue, 22 Sep 2020 15:04:06 +0000 (17:04 +0200)]
Try to fix test

4 years agoHandle out-of-bounds offset consistently in grapheme_* API
Nikita Popov [Tue, 22 Sep 2020 15:01:06 +0000 (17:01 +0200)]
Handle out-of-bounds offset consistently in grapheme_* API

Make sure we throw the same kind of error regardless of whether
the offset is out-of-bounds in the fast path or in the slow
path.

4 years agoFix grapheme out of bounds check
Nikita Popov [Tue, 22 Sep 2020 14:35:53 +0000 (16:35 +0200)]
Fix grapheme out of bounds check

An offset equal to the string length is not out of bounds.

4 years agoMerge branch 'PHP-7.4' into master
Christoph M. Becker [Tue, 22 Sep 2020 14:14:03 +0000 (16:14 +0200)]
Merge branch 'PHP-7.4' into master

* PHP-7.4:
  Fix #76943: Inconsistent stream_wrapper_restore() errors

4 years agoMerge branch 'PHP-7.3' into PHP-7.4
Christoph M. Becker [Tue, 22 Sep 2020 14:11:56 +0000 (16:11 +0200)]
Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #76943: Inconsistent stream_wrapper_restore() errors

4 years agoFix #76943: Inconsistent stream_wrapper_restore() errors
Christoph M. Becker [Tue, 22 Sep 2020 11:01:32 +0000 (13:01 +0200)]
Fix #76943: Inconsistent stream_wrapper_restore() errors

If restoring of any not registered built-in wrapper is requested, the
function is supposed to fail with a warning, so we have to check this
condition first.

Furthermore, to be able to detect whether a built-in wrapper has been
changed, it is not sufficient to check whether *any* userland wrapper
has been registered, but rather whether the specific wrapper has been
modified.

Closes GH-6183.

4 years agoSkip IMAP test which chokes on ASAN build
George Peter Banyard [Tue, 22 Sep 2020 13:43:31 +0000 (14:43 +0100)]
Skip IMAP test which chokes on ASAN build

4 years agoPromote pack/unpack format errors
Nikita Popov [Tue, 22 Sep 2020 12:08:13 +0000 (14:08 +0200)]
Promote pack/unpack format errors

Errors related to invalid format strings (unlike data mismatch
errors) should throw ValueError.

Closes GH-6185.

4 years agoConvert unpack offset warning to ValueError
Nikita Popov [Tue, 22 Sep 2020 12:00:48 +0000 (14:00 +0200)]
Convert unpack offset warning to ValueError

4 years agoMerge branch 'PHP-7.4' into master
Christoph M. Becker [Tue, 22 Sep 2020 11:19:06 +0000 (13:19 +0200)]
Merge branch 'PHP-7.4' into master

* PHP-7.4:
  Fix #79423: copy command is limited to size of file it can copy