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
4 changes: 4 additions & 0 deletions .github/actions/test-alpine/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ inputs:
runTestsParameters:
default: ''
required: false
enableOpcache:
default: 'false'
required: false
jitType:
default: 'disable'
required: false
Expand All @@ -15,6 +18,7 @@ runs:
export SKIP_IO_CAPTURE_TESTS=1
export STACK_LIMIT_DEFAULTS_CHECK=1
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
${{ inputs.enableOpcache == 'true' && '-d opcache.enable_cli=1' }} \
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.jit_buffer_size=64M \
-j$(nproc) \
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/test-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ inputs:
runTestsParameters:
default: ''
required: false
enableOpcache:
default: 'false'
required: false
jitType:
default: 'disable'
required: false
Expand Down Expand Up @@ -42,6 +45,7 @@ runs:
export SKIP_IO_CAPTURE_TESTS=1
export STACK_LIMIT_DEFAULTS_CHECK=1
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
${{ inputs.enableOpcache == 'true' && '-d opcache.enable_cli=1' }} \
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.protect_memory=1 \
-d opcache.jit_buffer_size=64M \
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/test-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ inputs:
runTestsParameters:
default: ''
required: false
enableOpcache:
default: 'false'
required: false
jitType:
default: 'disable'
required: false
Expand All @@ -16,6 +19,7 @@ runs:
export CI_NO_IPV6=1
export STACK_LIMIT_DEFAULTS_CHECK=1
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
${{ inputs.enableOpcache == 'true' && '-d opcache.enable_cli=1' }} \
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.protect_memory=1 \
-d opcache.jit_buffer_size=64M \
Expand Down
41 changes: 17 additions & 24 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ jobs:
- name: Test Tracing JIT
uses: ./.github/actions/test-alpine
with:
enableOpcache: true
jitType: tracing
runTestsParameters: >-
--asan -x
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
LINUX_X64:
Expand Down Expand Up @@ -185,33 +185,33 @@ jobs:
- name: Test Tracing JIT
uses: ./.github/actions/test-linux
with:
enableOpcache: true
jitType: tracing
runTestsParameters: >-
${{ matrix.asan && '--asan' || '' }}
${{ (matrix.asan && !inputs.all_variations) && '-x' || '' }}
${{ matrix.repeat && '--repeat 2' || '' }}
${{ matrix.variation && '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0' || '' }}
-d opcache.enable_cli=1
- name: Test OpCache
if: ${{ inputs.all_variations }}
uses: ./.github/actions/test-linux
with:
enableOpcache: true
runTestsParameters: >-
${{ matrix.asan && '--asan' || '' }}
${{ matrix.repeat && '--repeat 2' || '' }}
${{ matrix.variation && '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0' || '' }}
-d opcache.enable_cli=1
- name: Test Function JIT
# ASAN frequently timeouts. Each test run takes ~90 minutes, we can
# avoid running into the 6 hour timeout by skipping the function JIT.
if: ${{ inputs.all_variations && !matrix.asan }}
uses: ./.github/actions/test-linux
with:
enableOpcache: true
jitType: function
runTestsParameters: >-
${{ matrix.repeat && '--repeat 2' || '' }}
${{ matrix.variation && '-d zend_test.observer.enabled=1 -d zend_test.observer.show_output=0' || '' }}
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
- name: Verify generated files are up to date
Expand Down Expand Up @@ -282,22 +282,19 @@ jobs:
- name: Test Tracing JIT
uses: ./.github/actions/test-linux
with:
enableOpcache: true
jitType: tracing
runTestsParameters: >-
-d opcache.enable_cli=1
- name: Test OpCache
if: ${{ inputs.all_variations }}
uses: ./.github/actions/test-linux
with:
runTestsParameters: >-
-d opcache.enable_cli=1
enableOpcache: true
- name: Test Function JIT
if: ${{ inputs.all_variations }}
uses: ./.github/actions/test-linux
with:
enableOpcache: true
jitType: function
runTestsParameters: >-
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
MACOS:
Expand Down Expand Up @@ -340,22 +337,19 @@ jobs:
if: ${{ matrix.arch == 'X64' || !matrix.zts }}
uses: ./.github/actions/test-macos
with:
enableOpcache: true
jitType: tracing
runTestsParameters: >-
-d opcache.enable_cli=1
- name: Test OpCache
if: ${{ inputs.all_variations || (matrix.arch == 'ARM64' && matrix.zts) }}
uses: ./.github/actions/test-macos
with:
runTestsParameters: >-
-d opcache.enable_cli=1
enableOpcache: true
- name: Test Function JIT
if: ${{ inputs.all_variations && (matrix.arch == 'X64' || !matrix.zts) }}
uses: ./.github/actions/test-macos
with:
enableOpcache: true
jitType: function
runTestsParameters: >-
-d opcache.enable_cli=1
- name: Extra tests
uses: ./.github/actions/extra-tests
- name: Verify generated files are up to date
Expand Down Expand Up @@ -411,9 +405,8 @@ jobs:
- name: Test OpCache
uses: ./.github/actions/test-linux
with:
enableOpcache: true
jitType: tracing
runTestsParameters: >-
-d opcache.enable_cli=1
- uses: codecov/codecov-action@v5
if: ${{ !cancelled() }}
with:
Expand Down Expand Up @@ -655,34 +648,34 @@ jobs:
- name: Test File Cache (prime shm)
uses: ./.github/actions/test-linux
with:
enableOpcache: true
runTestsParameters: >-
-d opcache.enable_cli=1
--file-cache-prime
- name: Test File Cache (prime shm, use shm)
uses: ./.github/actions/test-linux
with:
enableOpcache: true
runTestsParameters: >-
-d opcache.enable_cli=1
--file-cache-use
- name: Test File Cache (prime shm, use file)
uses: ./.github/actions/test-linux
with:
enableOpcache: true
runTestsParameters: >-
-d opcache.enable_cli=1
--file-cache-use
-d opcache.file_cache_only=1
- name: Test File Cache Only (prime)
uses: ./.github/actions/test-linux
with:
enableOpcache: true
runTestsParameters: >-
-d opcache.enable_cli=1
--file-cache-prime
-d opcache.file_cache_only=1
- name: Test File Cache Only (use)
uses: ./.github/actions/test-linux
with:
enableOpcache: true
runTestsParameters: >-
-d opcache.enable_cli=1
--file-cache-use
-d opcache.file_cache_only=1
- name: Verify generated files are up to date
Expand Down Expand Up @@ -769,9 +762,9 @@ jobs:
- name: Test Opcache
uses: ./.github/actions/test-linux
with:
enableOpcache: true
runTestsParameters: >-
--msan
-d opcache.enable_cli=1
- name: Verify generated files are up to date
uses: ./.github/actions/verify-generated-files
LIBMYSQLCLIENT:
Expand Down
6 changes: 3 additions & 3 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
return fwrite(data, size, nmemb, write_handler->fp);
case PHP_CURL_RETURN:
if (length > 0) {
smart_str_appendl(&write_handler->buf, data, (int) length);
smart_str_appendl(&write_handler->buf, data, length);
}
break;
case PHP_CURL_USER: {
Expand Down Expand Up @@ -814,7 +814,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
if (!Z_ISUNDEF(retval)) {
_php_curl_verify_handlers(ch, /* reporterror */ true);
if (Z_TYPE(retval) == IS_STRING) {
length = MIN((size * nmemb), Z_STRLEN(retval));
length = MIN(size * nmemb, Z_STRLEN(retval));
memcpy(data, Z_STRVAL(retval), length);
} else if (Z_TYPE(retval) == IS_LONG) {
length = Z_LVAL_P(&retval);
Expand Down Expand Up @@ -845,7 +845,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
/* Handle special case write when we're returning the entire transfer
*/
if (ch->handlers.write->method == PHP_CURL_RETURN && length > 0) {
smart_str_appendl(&ch->handlers.write->buf, data, (int) length);
smart_str_appendl(&ch->handlers.write->buf, data, length);
} else {
PHPWRITE(data, length);
}
Expand Down
28 changes: 22 additions & 6 deletions ext/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1283,8 +1283,6 @@ PHP_FUNCTION(openssl_x509_free)
}
/* }}} */

/* }}} */

/* {{{ Creates and exports a PKCS to file */
PHP_FUNCTION(openssl_pkcs12_export_to_file)
{
Expand Down Expand Up @@ -1350,6 +1348,9 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file)

if (args && (item = zend_hash_str_find(Z_ARRVAL_P(args), "extracerts", sizeof("extracerts")-1)) != NULL) {
ca = php_openssl_array_to_X509_sk(item, 5, "extracerts");
if (!ca) {
goto cleanup;
}
}
/* end parse extra config */

Expand Down Expand Up @@ -1443,6 +1444,9 @@ PHP_FUNCTION(openssl_pkcs12_export)

if (args && (item = zend_hash_str_find(Z_ARRVAL_P(args), "extracerts", sizeof("extracerts")-1)) != NULL) {
ca = php_openssl_array_to_X509_sk(item, 5, "extracerts");
if (!ca) {
goto cleanup;
}
}
/* end parse extra config */

Expand Down Expand Up @@ -2662,7 +2666,10 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
goto clean_exit;
}
}
sk_X509_push(recipcerts, cert);
if (sk_X509_push(recipcerts, cert) <= 0) {
X509_free(cert);
goto clean_exit;
}
} ZEND_HASH_FOREACH_END();
} else {
/* a single certificate */
Expand All @@ -2683,7 +2690,10 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
goto clean_exit;
}
}
sk_X509_push(recipcerts, cert);
if (sk_X509_push(recipcerts, cert) <= 0) {
X509_free(cert);
goto clean_exit;
}
}

/* sanity check the cipher */
Expand Down Expand Up @@ -3278,7 +3288,10 @@ PHP_FUNCTION(openssl_cms_encrypt)
goto clean_exit;
}
}
sk_X509_push(recipcerts, cert);
if (sk_X509_push(recipcerts, cert) <= 0) {
php_openssl_store_errors();
goto clean_exit;
}
} ZEND_HASH_FOREACH_END();
} else {
/* a single certificate */
Expand All @@ -3298,7 +3311,10 @@ PHP_FUNCTION(openssl_cms_encrypt)
goto clean_exit;
}
}
sk_X509_push(recipcerts, cert);
if (sk_X509_push(recipcerts, cert) <= 0) {
php_openssl_store_errors();
goto clean_exit;
}
}

/* sanity check the cipher */
Expand Down
30 changes: 19 additions & 11 deletions ext/openssl/openssl_backend_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,29 +692,25 @@ STACK_OF(X509) *php_openssl_load_all_certs_from_file(
X509_INFO *xi;
char cert_path[MAXPATHLEN];

if(!(stack = sk_X509_new_null())) {
php_openssl_store_errors();
php_error_docref(NULL, E_ERROR, "Memory allocation failure");
goto end;
}

if (!php_openssl_check_path(cert_file, cert_file_len, cert_path, arg_num)) {
sk_X509_free(stack);
goto end;
}

if (!(in = BIO_new_file(cert_path, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY)))) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "Error opening the file, %s", cert_path);
sk_X509_free(stack);
goto end;
}

/* This loads from a file, a stack of x509/crl/pkey sets */
if (!(sk = php_openssl_pem_read_bio_x509_info(in))) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "Error reading the file, %s", cert_path);
sk_X509_free(stack);
goto end;
}

if(!(stack = sk_X509_new_reserve(NULL, sk_X509_INFO_num(sk)))) {
php_openssl_store_errors();
goto end;
}

Expand Down Expand Up @@ -886,7 +882,10 @@ STACK_OF(X509) *php_openssl_array_to_X509_sk(zval * zcerts, uint32_t arg_num, co
}

}
sk_X509_push(sk, cert);
if (sk_X509_push(sk, cert) <= 0) {
X509_free(cert);
goto push_fail_exit;
}
} ZEND_HASH_FOREACH_END();
} else {
/* a single certificate */
Expand All @@ -904,11 +903,20 @@ STACK_OF(X509) *php_openssl_array_to_X509_sk(zval * zcerts, uint32_t arg_num, co
goto clean_exit;
}
}
sk_X509_push(sk, cert);
if (sk_X509_push(sk, cert) <= 0) {
X509_free(cert);
goto push_fail_exit;
}
}

clean_exit:
return sk;

push_fail_exit:
php_openssl_store_errors();
php_openssl_sk_X509_free(sk);
sk = NULL;
goto clean_exit;
}

zend_result php_openssl_csr_add_subj_entry(zval *item, X509_NAME *subj, int nid)
Expand Down
1 change: 1 addition & 0 deletions ext/zend_test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,7 @@ PHP_MINIT_FUNCTION(zend_test)

memcpy(&zend_test_class_handlers, &std_object_handlers, sizeof(zend_object_handlers));
zend_test_class_handlers.get_method = zend_test_class_method_get;
zend_test_class_handlers.clone_obj = NULL;
zend_test_class_handlers.free_obj = zend_test_class_free_obj;
zend_test_class_handlers.offset = XtOffsetOf(zend_test_object, std);

Expand Down