php-src/ext/openssl/tests/bug50293.phpt
Peter Kokot 218a93b898 Use EXTENSIONS instead of SKIPIF sections in *.phpt
This also fixes skipped tests due to different naming "zend-test"
instead of "zend_test" and "PDO" instead of "pdo":

- ext/dom/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/simplexml/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/xmlreader/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/zend_test/tests/observer_sqlite_create_function.phpt

EXTENSIONS section is used for the Windows build to load the non-static
extensions.

Closes GH-13276
2024-01-31 11:18:21 +01:00

52 lines
1.3 KiB
PHP

--TEST--
Bug #50293 (Several openssl functions ignore the VCWD)
--EXTENSIONS--
openssl
--FILE--
<?php
$cert = "file://" . __DIR__ . "/cert.crt";
$priv = "file://" . __DIR__ . "/private_rsa_1024.key";
$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
$dn = [
"countryName" => "GB",
"stateOrProvinceName" => "Berkshire",
"localityName" => "Newbury",
"organizationName" => "My Company Ltd",
"commonName" => "Demo Cert",
];
$args = array(
"digest_alg" => "sha256",
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
"encrypt_key" => true,
"config" => $config
);
mkdir(__DIR__ . "/bug50293");
chdir(__DIR__ . "/bug50293");
$privkey = openssl_pkey_get_private('file://' . __DIR__ . '/private_ec.key');
$csr = openssl_csr_new($dn, $privkey, $args);
$sscert = openssl_csr_sign($csr, null, $privkey, 365, $args);
openssl_csr_export($csr, $csrout);;
openssl_x509_export($sscert, $certout);
openssl_x509_export_to_file($sscert , "bug50293.crt", false);
openssl_pkey_export_to_file($privkey, "bug50293.pem", null, $args);
var_dump(
file_exists("bug50293.crt"),
file_exists("bug50293.pem")
);
?>
--CLEAN--
<?php
@unlink(__DIR__ . "/bug50293/bug50293.crt");
@unlink(__DIR__ . "/bug50293/bug50293.pem");
@rmdir(__DIR__ . "/bug50293");
?>
--EXPECT--
bool(true)
bool(true)