Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
libpq+openssl conflict reproduce case
$db = parse_url(getenv("DATABASE_URL"));
$sql = "SELECT repeat('a', 160000)";
$c = pg_connect(sprintf("host='%s' port='%s' dbname='%s' user='%s' password='%s' sslmode='require'", $db["host"], $db["port"], substr($db["path"], 1), $db["user"], $db["pass"]));
$r = openssl_pkey_get_public('a');
while ($msg = openssl_error_string())
echo "Cleared OpenSSL error: <code>$msg</code><br />";
if($r = pg_query($sql))
echo "Query OK";
echo "Query failed: <code>".pg_last_error($c)."</code>";
<p>Run query again <a href="<?=$_SERVER["PHP_SELF"]?>?clear=1">with</a> or <a href="<?=$_SERVER["PHP_SELF"]?>">without</a> a workaround (clearing OpenSSL error stack with <code>openssl_error_string()</code> before running a query).</p>
<p>More info: <a href=""></a> and <a href=""></a></p>
<p>Patch: <a href=""></a></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment