Use mb_strlen to see if something is an empty string

This commit is contained in:
Mikael Nordfeldth 2016-02-26 01:04:59 +01:00
parent 29662eef5e
commit 519e3308ab

View File

@ -849,11 +849,12 @@ class Notice extends Managed_DataObject
$stored->url = $url; $stored->url = $url;
$stored->verb = $act->verb; $stored->verb = $act->verb;
$content = $act->content ?: $act->summary; // we use mb_strlen because it _might_ be that the content is just the string "0"...
if (is_null($content) && !is_null($actobj)) { $content = mb_strlen($act->content) ? $act->content : $act->summary;
$content = $actobj->content ?: $actobj->summary; if (mb_strlen($content)===0 && !is_null($actobj)) {
$content = mb_strlen($actobj->content) ? $actobj->content : $actobj->summary;
} }
// Strip out any bad HTML // Strip out any bad HTML from $content
$stored->rendered = common_purify($content); $stored->rendered = common_purify($content);
$stored->content = common_strip_html($stored->getRendered(), true, true); $stored->content = common_strip_html($stored->getRendered(), true, true);
if (trim($stored->content) === '') { if (trim($stored->content) === '') {