Nikita Popov [Wed, 16 Dec 2020 14:17:13 +0000 (15:17 +0100)]
PDO MySQL: Use mysqlnd column names
mysqlnd already creates interned zend_strings for us, so let's
make use of them.
This also required updating the PDO case changing code to work
with potentially shared strings. For the lowercasing, use the
optimized zend_string_tolower() implementation.
Nikita Popov [Wed, 16 Dec 2020 09:16:50 +0000 (10:16 +0100)]
Fix bug #80523
Don't truncate the file length to unsigned int...
I have no idea whether that fully fixes the problem because the
process gets OOM killed before finishing, but at least the
immediate parse error is gone now.
Nikita Popov [Tue, 15 Dec 2020 11:29:15 +0000 (12:29 +0100)]
MySQLnd: Drop free_result_internal
Merge it into free_result. There is a large number of different
free_* functions for result sets, let's avoid having one more.
Only difference is that it does not increment stats, and that
seems like a bug as free_stmt_result is still freeing a result.
Nikita Popov [Tue, 15 Dec 2020 10:50:30 +0000 (11:50 +0100)]
MySQLnd: Simplify management of zval row buffer
Something odd was being done here, with the row packet having a
flag for whether it should allocate the zval buffer, which would
then get moved into the result set.
Keep the management of this buffer purely at the result set level.
This also allows us to easily reuse the same buffer for all results,
rather than allocating a new one for each fetch.
JIT: Update invalid opcache.jit INI value message to include "tracing" and "function" values
`opcache.jit` accepts `tracing` and `function` as aliases, but they were not mentioned in the start-up INI warning message.
This updates the error message to include all possible values.
Calvin Buckley [Thu, 10 Dec 2020 18:25:32 +0000 (14:25 -0400)]
IBM i PASE doesn't support ITIMER_PROF
Like Cygwin, this platform needs to use a real-time timer.
This was based on a patch by @kadler, but it didn't handle unsetting
the timer, so the timeout would continue to be active, triggering
`hard_timeout` unexpectedly. The patch is fixed to handle unsetting.
Like the test title and some comments in this test describe, this test
was supposed to have `::prepare()` failing because `LOAD DATA INFILE`
would not be supported as prepared statement, and then the test checks
whether follow-up queries would succeed. However, `LOAD DATA INFILE`
is supported for prepared statements at least on Windows with mysqlnd,
so the test does no longer test what it is supposed to do. Therefore,
we drop it.
Nikita Popov [Mon, 14 Dec 2020 09:17:57 +0000 (10:17 +0100)]
Allow building dblib with machine-dependent libdir
Use the same approach as for GMP: If no explicit directory is
given, assume it must be on the default include path and libdir.
Otherwise use the provided path. It does not look like libsybdb
has support for pkg-config.
`version_compare()` does a sloppy check for the `$operators` argument
which allows arbitrary abbreviations of the supported operators to be
accepted. This is both undocumented and unexpected, and could lead to
subtle BC breaks, if the order of the comparisions will be changed.
Therefore we change to strict comparisons.
Anatol Belski [Mon, 2 Nov 2020 19:00:28 +0000 (20:00 +0100)]
hash: Support custom algo parameters
The concrete need on this change is to support passing an initial seed
to the murmur hash. Passing a custom seed is important in terms of
randomizing the hash function.
The suggested implementation adds a HashTable parameter to all the
init callbacks. Further on, an array with custom arguments is accepted
from `hash` or `hash_init` from the user land. Currently several things
like `hash_hkdf` are not touched, as they don't need passing custom
args.
Some convenience macros have been added to the SHA/MD families of
functions, so the consuming code doesn't have to be changed widely.
Another way to implement this is to add another type of the init that
would accept a HT with arguments. However, that would still require
touching all the context structs in all the algos. That would also
increase the size of those structs. As an init function is called just
once, the way of modifying the existing init callback has been seen
as more preferrable.
Nikita Popov [Fri, 11 Dec 2020 11:13:52 +0000 (12:13 +0100)]
PDO MySQL: Use stmt_next_result with libmysqlclient as well
libmysqlclient added this function in version 5.5, which happens
to be the minimum we support. If we have a prepared statement,
we should use it on both mysqlnd and libmysqlclient, even if the
handling afterwards is different.
This fixes error handling with native prepared statements.
Nikita Popov [Fri, 11 Dec 2020 11:04:44 +0000 (12:04 +0100)]
PDO MySQL: Fix libmysql option test
The fact that getAttribute() fails for various libmysqlclient-only
options is a known issue, and the test was taking that into account.
However, the change of the default error mode broke the handling.
We need to handle the exceptions now.
Nikita Popov [Fri, 11 Dec 2020 10:20:33 +0000 (11:20 +0100)]
Fixed bug #62889
Our minimum libmysqlclient version requirement is high enough
that we don't need to check for MYSQL_OPT_LOCAL_INFILE support.
However, the mysql_get_option() function seems to only be available
since 5.7 (though it's really hard to find any definitie information
on when MySQL introduced certain functions or changes...) so we
need to store the value of the flag locally to make it available
through getAttribute().
Nikita Popov [Thu, 10 Dec 2020 15:52:17 +0000 (16:52 +0100)]
Fixed bug #72368
Generate a param count mismatch error even if the query contains
no placeholders.
Additionally we shouldn't HANDLE errors from pdo_parse_params,
which are always reported via raise_impl_error. Doing so results
in duplicate error messages.
Nikita Popov [Thu, 10 Dec 2020 14:51:17 +0000 (15:51 +0100)]
Fixed bug #79131
When a driver reports an error during EVT_ALLOC (and some over EVTs),
make sure we handle it as usual, i.e. warn or throw.
This requires some adjustments in PDO PgSQL to stop manually doing
this through an impl error.
Unfortunately the PDO PgSQL error messages regress because of this,
as they now include a completely arbitrary error code. There doesn't
seem to be an ability to skip it right now.