Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ext/uri/uriparser/include/uriparser/Uri.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ URI_PUBLIC int URI_FUNC(ParseSingleUriExMm)(URI_TYPE(Uri) * uri,
* itself is not freed, only its members.
* Uses default libc-based memory manager.
*
* @remarks
* Calling on an all-zeros structure (e.g. through <c>memset</c> or <c>calloc</c>) is safe.<br/>
* Calling on an uninitialized structure is <em>not</em> safe.
*
* @param uri <b>INOUT</b>: %URI structure whose members should be freed
*
* @see uriFreeUriMembersMmA
Expand All @@ -348,6 +352,10 @@ URI_PUBLIC void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri);
* of the %URI structure. Note that the structure
* itself is not freed, only its members.
*
* @remarks
* Calling on an all-zeros structure (e.g. through <c>memset</c> or <c>calloc</c>) is safe.<br/>
* Calling on an uninitialized structure is <em>not</em> safe.
*
* @param uri <b>INOUT</b>: %URI structure whose members should be freed
* @param memory <b>IN</b>: Memory manager to use, NULL for default libc
* @return 0 on success, error code otherwise
Expand Down
7 changes: 6 additions & 1 deletion ext/uri/uriparser/src/UriCopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri,

URI_CHECK_MEMORY_MANAGER(memory); /* may return */

URI_FUNC(ResetUri)(destUri);

if (URI_FUNC(CopyRangeAsNeeded)(&destUri->scheme, &sourceUri->scheme, URI_FALSE, memory) == URI_FALSE) {
return URI_ERROR_MALLOC;
}
Expand Down Expand Up @@ -153,7 +155,10 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri,
*(destUri->hostData.ip6) = *(sourceUri->hostData.ip6);
}

if (URI_FUNC(CopyRangeAsNeeded)(&destUri->hostData.ipFuture, &sourceUri->hostData.ipFuture, URI_FALSE, memory) == URI_FALSE) {
if (sourceUri->hostData.ipFuture.first != NULL && sourceUri->hostText.first == sourceUri->hostData.ipFuture.first) {
destUri->hostData.ipFuture.first = destUri->hostText.first;
destUri->hostData.ipFuture.afterLast = destUri->hostText.afterLast;
} else if (URI_FUNC(CopyRangeAsNeeded)(&destUri->hostData.ipFuture, &sourceUri->hostData.ipFuture, URI_FALSE, memory) == URI_FALSE) {
URI_FUNC(PreventLeakageAfterCopy)(destUri, doneMask, memory);
return URI_ERROR_MALLOC;
}
Expand Down
6 changes: 1 addition & 5 deletions sapi/fpm/tests/socket-uds-too-long-filename-start.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ $tester->expectLogPattern(

$files = glob($socketFilePrefix . '*');

if ($files === []) {
echo 'Socket files were not found.' . PHP_EOL;
}

if ($socketFile === $files[0]) {
if (isset($files[0]) && $socketFile === $files[0]) {
// this means the socket file path length is not an issue (anymore). Might be not long enough
echo 'Socket file is the same as configured.' . PHP_EOL;
}
Expand Down