| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.
This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)
RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
Closes GH-6475.
|
|
|
|
|
|
|
| |
While "" is already treated the same way as absence, null is the
logically correct default here. Making this one argument non-nullable
is particularly pecular when considering that the preceding $alias
and $index arguments are both nullable.
|
|\
| |
| |
| |
| | |
* PHP-7.4:
Fix #70091: Phar does not mark UTF-8 filenames in ZIP archives
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The default encoding of filenames in a ZIP archive is IBM Code Page
437. Phar, however, only supports UTF-8 filenames. Therefore we have
to mark filenames as being stored in UTF-8 by setting the general
purpose bit 11 (the language encoding flag).
The effect of not setting this bit for non ASCII filenames can be seen
in popular tools like 7-Zip and UnZip, but not when extracting the
archives via ext/phar (which is agnostic to the filename encoding), or
via ext/zip (which guesses the encoding). Thus we add a somewhat
brittle low-level test case.
Closes GH-6630.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix #75850: Unclear error message wrt. __halt_compiler() w/o semicolon
|
| |
| |
| |
| |
| |
| | |
We add the failure reason to the error message.
Closes GH-6638.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Add missing SKIPIF clause for recently introduced test case
|
| | |
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Add missing SKIPIF clauses to new test cases
|
| | |
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix #69279: Compressed ZIP Phar extractTo() creates garbage files
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When extracting compressed files from an uncompressed Phar, we must not
use the direct file pointer, but rather get an uncompressed file
pointer.
We also add a test to show that deflated and stored entries are
properly extracted.
This also fixes #79912, which appears to be a duplicate of #69279.
Co-authored-by: Anna Filina <afilina@gmail.com>
Closes GH-6599.
|
| | |
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix #77565: Incorrect locator detection in ZIP-based phars
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We must not assume that the first end of central dir signature in a ZIP
archive actually designates the end of central directory record, since
the data in the archive may contain arbitrary byte patterns. Thus, we
better search from the end of the data, what is also slightly more
efficient.
There is, however, no way to detect the end of central directory
signature by searching from the end of the ZIP archive with absolute
certainty, since the signature could be part of the trailing comment.
To mitigate, we check that the comment length fits to the found
position, but that might still not be the correct position in rare
cases.
Closes GH-6507.
|
| |
| |
| |
| |
| |
| |
| | |
We must not alias the closed stream to `phar_archive_data.fp`, and use
PHAR_ZIP_FAIL() for consistency with the rest of this function.
Closes GH-6578.
|
| |
| |
| |
| |
| |
| | |
Based on the patch provided by david at bamsoftware.
Closes GH-6517.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix #77322: PharData::addEmptyDir('/') Possible integer overflow
|
| |
| |
| |
| |
| |
| |
| | |
`phar_path_check()` already strips a leading slash, so we must not
attempt to strip the trailing slash from an now empty directory name.
Closes GH-6508.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix #75102: `PharData` says invalid checksum for valid tar
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Apparently, there are broken tarballs out there which are actually in
ustar format, but did not write the `ustar` marker. Since popular tar
tools like GNU tar and 7zip have no issues dealing with such tarballs,
Phar should also be more resilient.
Thus, when the first checksum check of a tarball in (presumed) in old-
style format fails, we check whether the checksum would be suitable for
ustar format; if so, we treat the tarball as being in ustar format.
Closes GH-6479.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix #73809: Phar Zip parse crash - mmap fail
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Phar signatures practically are of limited size; for the MD5 and SHA
hashes the size is fixed (at most 64 bytes for SHA512); for OpenSSL
public keys there is no size limit in theory, but "64 KiB ought to be
good enough for anybody". So we check for that limit, to avoid fatal
errors due to out of memory conditions.
Since it is neither possible to have the signature compressed in the
ZIP archive, nor is it possible to manually add a signature via Phar,
we use ZipArchive to create a suitable archive for the test on the fly.
Closes GH-6474.
|
| |
| |
| |
| | |
Closes GH-6307.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Rather than using Greg's birthday, use null to indicate that the
existing format/compression should be retained. For the format
simply using zero would be sufficient, but as the documentation
explicitly says that NULL is allowed here, we may as well make
that the truth.
|
| |
| |
| |
| | |
Closes GH-6284.
|
| |
| |
| |
| |
| |
| |
| | |
Also change $max_length to $length in a number of filesystem APIs,
where our usage was inconsistent.
Closes GH-6276.
|
| |
| |
| |
| | |
Closes GH-6214.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
|
| |
| |
| |
| | |
Closes GH-5999
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently we treat paths with null bytes as a TypeError, which is
incorrect, and rather inconsistent, as we treat empty paths as
ValueError. We do this because the error is generated by zpp and
it's easier to always throw TypeError there.
This changes the zpp implementation to throw a TypeError only if
the type is actually wrong and throw ValueError for null bytes.
The error message is also split accordingly, to be more precise.
Closes GH-6094.
|
| |
| |
| |
| | |
Closes GH-6075
|
| | |
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Skip test if A: drive exists
|
| |\
| | |
| | |
| | |
| | | |
* PHP-7.3:
Skip test if A: drive exists
|
| | |
| | |
| | |
| | | |
Otherwise the test case will fail for a very different reason.
|
| | |\
| | | |
| | | |
| | | |
| | | |
| | | | |
* PHP-7.2:
Fix #79877: getimagesize function silently truncates after a null byte
Fix #79797: Use of freed hash key in the phar_parse_zipfile function
|
| | | |
| | | |
| | | |
| | | | |
We must not use heap memory after we freed it.
|
| | | |
| | | |
| | | |
| | | | |
all-access permissions
|
| | | |
| | | |
| | | |
| | | | |
We must not use heap memory after we freed it.
|
| | | |
| | | |
| | | |
| | | | |
Closes GH-6008
|
| | | |
| | | |
| | | |
| | | |
| | | | |
On alpine lsof accepts -p but it doesn't actually do anything.
Add a crude check for whether lsof looks like Linux lsof.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
Closes GH-5958
|
| | | |
| | | |
| | | |
| | | | |
Closes GH-5950
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In other words, don't automatically unserialize when the magic
phar:// stream wrappers are used.
RFC: https://wiki.php.net/rfc/phar_stop_autoloading_metadata
Also, change the signature from `getMetadata()`
to `getMetadata(array $unserialize_options = [])`.
Start throwing earlier if setMetadata() is called and serialization threw.
See https://externals.io/message/110856 and
https://bugs.php.net/bug.php?id=76774
This was refactored to add a phar_metadata_tracker for the following reasons:
- The way to properly copy a zval was previously implicit and undocumented
(e.g. is it a pointer to a raw string or an actual value)
- Avoid unnecessary serialization and unserialization in the most common case
- If a metadata value is serialized once while saving a new/modified phar file,
this allows reusing the same serialized string.
- Have as few ways to copy/clone/lazily parse metadata (etc.) as possible,
so that code changes can be limited to only a few places in the future.
- Performance is hopefully not a concern - copying a string should be faster
than unserializing a value, and metadata should be rare in most cases.
Remove unnecessary skip in a test(Compression's unused)
Add additional assertions about usage of persistent phars
Improve robustness of `Phar*->setMetadata()`
- Add sanity checks for edge cases freeing metadata, when destructors
or serializers modify the phar recursively.
- Typical use cases of php have phar.readonly=1 and would not be affected.
Closes GH-5855
|
| | | |
| | | |
| | | |
| | | | |
We must not use heap memory after we freed it.
|
| | | |
| | | |
| | | |
| | | | |
Closes GH-5590
|
| | | |
| | | |
| | | |
| | | | |
Closes GH-5779
|