Commit 35ae171e authored by Malcolm Blaney's avatar Malcolm Blaney

Fixed a bug in discover_endpoint where $result variable was being

overwritten. Renamed all variables that are used to return a mysqli
result to $mysqli_result as calling them $result is confusing.
parent 308c6a98
Pipeline #40121665 passed with stage
in 1 minute and 12 seconds
......@@ -180,11 +180,11 @@ function discover_endpoint($us_url, $rels) {
$us_photo = '';
$url = $mysqli->escape_string($us_url);
$query = 'SELECT photo FROM nickname WHERE url = "' . $url . '"';
if ($result = $mysqli->query($query)) {
if ($nickname = $result->fetch_assoc()) {
if ($mysqli_result = $mysqli->query($query)) {
if ($nickname = $mysqli_result->fetch_assoc()) {
$us_photo = $nickname['photo'];
}
$result->close();
$mysqli_result->close();
}
else {
log_db('microformats->discover_endpoint 1: ' . $mysqli->error);
......@@ -355,12 +355,12 @@ function parse_hcard($author, $name_only = false) {
$url = $mysqli->escape_string($us_author_url);
// Check if there's an existing photo to avoid caching it again.
$query = 'SELECT photo, cache FROM nickname WHERE url = "' . $url . '"';
if ($result = $mysqli->query($query)) {
if ($nickname = $result->fetch_assoc()) {
if ($mysqli_result = $mysqli->query($query)) {
if ($nickname = $mysqli_result->fetch_assoc()) {
$us_photo = $nickname['photo'];
$us_cache = $nickname['cache'];
}
$result->close();
$mysqli_result->close();
}
else {
log_db('microformats->parse_hcard 1: ' . $mysqli->error);
......@@ -373,11 +373,11 @@ function parse_hcard($author, $name_only = false) {
}
$repost_url = $mysqli->escape_string($us_repost_url);
$query = 'SELECT photo FROM nickname WHERE url = "' . $repost_url . '"';
if ($result = $mysqli->query($query)) {
if ($nickname = $result->fetch_assoc()) {
if ($mysqli_result = $mysqli->query($query)) {
if ($nickname = $mysqli_result->fetch_assoc()) {
$us_repost_photo = $nickname['photo'];
}
$result->close();
$mysqli_result->close();
}
else {
log_db('microformats->parse_hcard 2: ' . $mysqli->error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment