Tyson Andre [Mon, 10 Aug 2020 02:07:33 +0000 (22:07 -0400)]
Add `run-tests.php --context [n]` option.
Mentioned in https://github.com/php/php-src/pull/5965#discussion_r467621123
This PR proposes 3 lines of context so the impact can be seen in tests.
Other `diff` programs show around 3 lines of context.
(This helps indicate exactly which position a test should be updated
to add a new expected line at)
Use the mapping for choosing order to display diffs
Properly include context in cases where the expected output had more lines than
the actual output, e.g.
```
--FILE--
A
A1
A
C
NEARBY
--EXPECTF--
A
B
A1
B
A
B
A
B
NEARBY
```
We have to ensure that the attempted connection to the MySQL server
fails, and do that by passing an unknown host instead of falling back
to localhost.
Nikita Popov [Fri, 14 Aug 2020 13:07:55 +0000 (15:07 +0200)]
Use variadic signature for PDOStatement::fetchAll()
The current signature is incorrect, because the $ctor_args parameter
is not required to be an array (it can at least also be null, and
isn't enforced by an exception anyway).
I'm going for the variadic signature here, because we already use
the same variadic signature in PDO::query() and
PDOStatement::setFetchMode(), all of them accepting essentially the
same arguments.
Nikita Popov [Fri, 14 Aug 2020 10:44:13 +0000 (12:44 +0200)]
Don't assert mysql->mysql is non-null
There is an edge case in constructor behavior where we can end up
with mysql->mysql being NULL (rather than mysql itself already being
NULL). I think that ultimately that's a bug in the constructor code,
and we should probably be destroying the outer structure on
construction failure as well. However it's pretty hard to unravel
with when considering all the construction permutations.
Nikita Popov [Fri, 14 Aug 2020 08:52:34 +0000 (10:52 +0200)]
Return empty string from SplFileInfo::getPathname()
Instead of false. This is consistent with how other methods like
SplFileInfo::getPath() behave. It's also a requirement before
SplFileInfo::__toString() calls SplFileInfo::getPathname() and
needs to return a string.
Nikita Popov [Fri, 14 Aug 2020 08:22:42 +0000 (10:22 +0200)]
Fix bug #78770
Refactor the zend_is_callable implementation to check callability
at a particular frame (this is an implementation detail for now,
but could be exposed in the API if useful). Pick the first parent
user frame as the one to check.
Nikita Popov [Wed, 24 Jun 2020 15:00:32 +0000 (17:00 +0200)]
Switch to mime-db as source of extension => MIME map
The Apache MIME type map is not actively maintained anymore, so
this switches to jshttp/mime-db, which seems to be the de-facto
standard in this area now. This avoid the need to patch in our
own MIME types over time.
Nikita Popov [Wed, 12 Aug 2020 15:06:02 +0000 (17:06 +0200)]
Make strftime tests musl compatible
* Remove usage of strftime() in favor of date() in cases where
we are not specifically testing strftime(). We implement
date() ourselves, and as such are insulated from implementation-
defined behavior.
* Add skipif for broken strftime() %Z support. We have decided
not to work around the issue for musl using manual expansion,
as people should not be using this function anyway, and it is
slated for future deprecation.
* Don't test strftime() with invalid format specifier. The
behavior is implementation-dependent.
Tyson Andre [Sun, 9 Aug 2020 15:26:51 +0000 (11:26 -0400)]
Support NO_COLOR environment variable in run-tests.php
And add a --color option for run-tests.php
See https://no-color.org/
> an informal standard is hereby proposed:
>
> All command-line software which outputs text with ANSI color added should check
> for the presence of a `NO_COLOR` environment variable that, when present
> (regardless of its value), prevents the addition of ANSI color.
Nikita Popov [Wed, 12 Aug 2020 08:32:05 +0000 (10:32 +0200)]
Disable report_zend_debug by default
We might just want to drop this completely, but at least don't
enable it by default. It already gets disabled by a number of
SAPIs, but we should make that the default state.
Tyson Andre [Mon, 10 Aug 2020 23:48:41 +0000 (19:48 -0400)]
Rename standard array function parameters to $array
This is targeting 8.0.
`$arg` seems like a poor choice of a name,
especially if the function were to have arguments added.
In many cases, the php.net documentation already has $array for these functions.
E.g. https://www.php.net/manual/en/function.array-intersect.php
I'd assume that since named arguments was added to 8.0 near the feature freeze,
PHP's maintainers had planned to make the names consistent
and gradually use the same name for docs and implementation.
Ahmed Abdou [Sun, 17 Feb 2019 21:59:00 +0000 (22:59 +0100)]
Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
PDO driver constructors are throwing PdoException without setting
errorInfo, so create a new reusable function that throws exceptions
for PDO and will also set the errorInfo. Use this function in
pdo_mysql, pdo_sqlite, and pdo_pgsql.
Fix bug #75785 by attempt switching endianness on Maker's Note
Different manufacturer models may come with a
different endianness (motorola/intel) format. In
order to avoid a big refactor and a gigantic lookup
table, this commit simply attempts to switch the
endianness and proceed when values are acceptable.