Created
February 12, 2016 23:50
-
-
Save dzuelke/e4051b55431101a06456 to your computer and use it in GitHub Desktop.
libpq+openssl conflict reproduce case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
<?php | |
$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'); | |
if(isset($_GET["clear"])) | |
while ($msg = openssl_error_string()) | |
echo "Cleared OpenSSL error: <code>$msg</code><br />"; | |
if($r = pg_query($sql)) | |
echo "Query OK"; | |
else | |
echo "Query failed: <code>".pg_last_error($c)."</code>"; | |
?> | |
</p> | |
<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="https://bugs.php.net/bug.php?id=68276">https://bugs.php.net/bug.php?id=68276</a> and <a href="http://www.postgresql.org/message-id/flat/[email protected]#[email protected]">http://www.postgresql.org/message-id/flat/[email protected]</a></p> | |
<p>Patch: <a href="http://www.postgresql.org/message-id/flat/CAM3SWZSOJ1p-6jE+h8iii6WboBmyFHuJto=S2Fk==y1wLV3pSQ@mail.gmail.com#CAM3SWZSOJ1p-6jE+h8iii6WboBmyFHuJto=S2Fk==y1wLV3pSQ@mail.gmail.com">http://www.postgresql.org/message-id/flat/CAM3SWZSOJ1p-6jE+h8iii6WboBmyFHuJto=S2Fk==y1wLV3pSQ@mail.gmail.com#CAM3SWZSOJ1p-6jE+h8iii6WboBmyFHuJto=S2Fk==y1wLV3pSQ@mail.gmail.com</a></p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment