3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function getDomain() { return 'example.com'; } function getSubDomains() { return array('www.example.com'); } function register($domainKeys, $subdomains) { $domains = (array) getDomain(); if ($subdomains == null) { $domains = array_merge($domains, getSubdomains()); } else { $domains = array_merge($domains, $subdomains); } $san = implode(",", array_map(function ($dns) { return "DNS:" . $dns; }, $domains)); $csr = openssl_csr_new([ "CN" => reset($domains), "ST" => "Germany", "C" => "DE", "O" => "Unknown", "subjectAltName" => $san, "basicConstraints" => "CA:FALSE", "extendedKeyUsage" => "serverAuth", ], $privateKey, [ "digest_alg" => "sha256", "req_extensions" => "v3_req", ]); return $csr; } var_dump(register(null, (array)$nonset));
based on 9XfAX
Output for 7.0.20, 7.1.5 - 7.2.0
Notice: Undefined variable: nonset in /in/3vVgq on line 35 bool(false)
Output for 5.4.15 - 7.0.6, 7.1.0
Notice: Undefined variable: nonset in /in/3vVgq on line 35 resource(4) of type (OpenSSL X.509 CSR)
Output for 5.4.11 - 5.4.14
Notice: Undefined variable: nonset in /in/3vVgq on line 35 Fatal error: Call to undefined function openssl_csr_new() in /in/3vVgq on line 20
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/3vVgq on line 20
Process exited with code 255.