Skip to content

Commit 59798af

Browse files
committed
Fix GH-158: Replace empty() with strict string comparison for sdesc/ldesc
Both sdesc and ldesc are always initialized as "" in storeInfo() and populated with htmlentities(trim(...)) results, so they are always strings. Using empty() is overly broad here since it would also treat a legitimate "0" value as empty. Replace with === "" for precision. The third occurrence in Package/PEAR/Web.php was already removed in commit 53f9afe.
1 parent e012bdf commit 59798af

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎phpdotnet/phd/Index.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public function format_long_desc($open, $name, $attrs, $props) {
358358
return;
359359
}
360360
$this->inLongDesc = false;
361-
if (empty($this->nfo[$this->currentid]["ldesc"])) {
361+
if ($this->nfo[$this->currentid]["ldesc"] === "") {
362362
$this->nfo[$this->currentid]["ldesc"] = htmlentities(trim($this->currentLongDesc), ENT_COMPAT, "UTF-8");
363363
}
364364
}
@@ -370,7 +370,7 @@ public function format_short_desc($open, $name, $attrs, $props) {
370370
}
371371
$this->inShortDesc = false;
372372
$s = htmlentities(trim($this->currentShortDesc), ENT_COMPAT, "UTF-8");
373-
if (empty($this->nfo[$this->currentid]["sdesc"])) {
373+
if ($this->nfo[$this->currentid]["sdesc"] === "") {
374374
$this->nfo[$this->currentid]["sdesc"] = $s;
375375
} else {
376376
if (!is_array($this->nfo[$this->currentid]["sdesc"])) {

0 commit comments

Comments
 (0)