Remove channels from getimagesize() results for WebP
Both lossless and lossy WebP can have an alpha channel, but this is
somewhat hard to detect. Furthermore, it is not clear whether an alpha
channel should be counted for getimagesize(). Therefore we remove the
`channel` element from the result array.
Nikita Popov [Sat, 8 Oct 2016 14:56:17 +0000 (16:56 +0200)]
Fix bug #66773, #66862
This a partial backport of 8754b19. It
a) fixes the class/function/constant import table confusion in the
namespaced case, and
b) restricts conflict checks to a single file based on a filename
pointer comparison.
It does not fix the issues with filename reuse (e.g. due to eval)
and late-bound classes. This part of the change requires globals
changes.
This ammends commit 14d4ee93 to also add support for the extended
WebP format, according to
<https://developers.google.com/speed/webp/docs/riff_container>.
This ammends commit 14d4ee93 to also add support for simple lossless
WebP, according to
<https://chromium.googlesource.com/webm/libwebp/+/master/doc/webp-lossless-bitstream-spec.txt>
We add WebP support for getimagesize(), getimagesizefromstring)(),
image_type_to_extension() and image_type_to_mime_type(). For now we
care only about the simple lossy WebP format (VP8) and ignore the
lossless (VP8L) and extended (VP8X) formats. We use image/webp as MIME
type as it appears to be pretty common, even though it is not yet
registered with IANA.
Unify error handling of bundled and external libgd
There's no need anymore to call an own error handler directly. Instead we
register our error handler and call libgd's error functions (which will
forward). We do this regardless of compiling with the bundled or an external
libgd.
Nikita Popov [Thu, 6 Oct 2016 21:09:41 +0000 (23:09 +0200)]
Fix "already in use" check inconsistencies/bugs
This fixes the following issues:
* "use function" and "use const" inside namespaced code were checking
for conflicts against class imports. Now they always check against
the correct symbol type.
* Symbol conflicts are now always checked within a single file only.
Previously class uses inside namespaced code were checked globally.
This behavior is illegal because symbols from other files are not
visible if opcache is used, resulting in behavioral discrepancies.
Additionally this made the presence/absence of symbol errors dependent
on autoloading order, which is volatile.
* The "single file" restriction is now enforced by collecting defined
symbols inside a separate hash table. Previously it was enforced
(for the non-namespaced case) by comparing the filename of the
symbol declaration. However this is inaccurate if the same filename
is used multiple times, such as may happen if eval() is used.
* Additionally the previous approach relies on symbols being registered
at compile-time, which is not the case for late-bound classes, which
makes the behavior dependent on class declaration order, as well as
opcache (which may cause delayed early-binding).
* Lastly, conflicts are now consistently checked for conditionally
defined symbols. Previously only declaration-after-use conflicts were
checked in this case. Now use-after-declaration conflicts are
detected as well.
Bob Weinand [Thu, 6 Oct 2016 08:36:12 +0000 (10:36 +0200)]
Use better fix for preventing too early freeing of interned strings
Works also with opcache now - just prevent zend_interned_strings_restore completely - zend_interned_strings_dtor will take care as phpdbg only ever uses one single request cycle per module cycle
Dmitry Stogov [Thu, 6 Oct 2016 08:16:43 +0000 (11:16 +0300)]
Merge branch 'PHP-7.1'
* PHP-7.1:
Updated reference-counting inferece rules. The previous rules refected PHP-5 behavior and were completely wrong for PHP-7. (e.g. scalars don't have reference counters at all). This change shouldn't affect anything, because results of this inference are not used yet.
Fix NEWS after re-roll of RC3
Dmitry Stogov [Thu, 6 Oct 2016 08:08:01 +0000 (11:08 +0300)]
Updated reference-counting inferece rules.
The previous rules refected PHP-5 behavior and were completely wrong for PHP-7. (e.g. scalars don't have reference counters at all).
This change shouldn't affect anything, because results of this inference are not used yet.
Derick Rethans [Wed, 5 Oct 2016 15:24:15 +0000 (11:24 -0400)]
Improve support for microseconds with Date/Time
It fixes several bugs:
- Fixed bug #45554 (Inconsistent behavior of the u format char).
- Fixed bug #48225 (DateTime parser doesn't set microseconds for "now").
- Fixed bug #52514 (microseconds are missing in DateTime class).
- Fixed bug #52519 (microseconds in DateInterval are missing).
- Fixed bug #68506 (General DateTime improvments needed for microseconds to become useful).
- Fixed bug #73109 (timelib_meridian doesn't parse dots correctly).
- Fixed bug #73247 (DateTime constructor does not initialise microseconds property).
It also updates timelib to 2016.04, and updates a data mapping file, which
causes changes to the volatile abbreviations tests.
* PHP-7.1:
Fixed test
Added validation to parse_url() to prohibit restricted characters inside login/pass components based on RFC3986
Apparently negative wordwrap is a thing and should work as length = 0.
* PHP-7.0:
Fixed test
Added validation to parse_url() to prohibit restricted characters inside login/pass components based on RFC3986
Apparently negative wordwrap is a thing and should work as length = 0.
* PHP-5.6:
Fixed test
Added validation to parse_url() to prohibit restricted characters inside login/pass components based on RFC3986
Apparently negative wordwrap is a thing and should work as length = 0.
gdLayerMultiply() has been introduced in libgd 2.1.1, and as such would have
been already available for imagelayereffect() with a system libgd. We port
the respective code to the bundled libgd, and also make IMG_EFFECT_MULTIPLY
available to userland.
Instead of rolling our own in the bundled libgd, we use libgd's anti-aliased
drawing API. This way imageantialias() is also available, when built against
a system libgd.