diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/entities.php | 5 | ||||
-rw-r--r-- | engine/lib/output.php | 3 | ||||
-rw-r--r-- | engine/tests/regression/trac_bugs.php | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index dbb5ee695..daced6740 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -669,7 +669,10 @@ function get_entity($guid) { static $newentity_cache; $new_entity = false; - if (!is_numeric($guid)) { + // We could also use: if (!(int) $guid) { return FALSE }, + // but that evaluates to a false positive for $guid = TRUE. + // This is a bit slower, but more thorough. + if (!is_numeric($guid) || $guid === 0 || $guid === '0') { return FALSE; } diff --git a/engine/lib/output.php b/engine/lib/output.php index 60bcc72cd..989eca60e 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -306,6 +306,9 @@ function elgg_get_friendly_title($title) { } //$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title); + + // use A-Za-z0-9_ instead of \w because \w is locale sensitive + $title = preg_replace("/[^A-Za-z0-9_ ]/", "", $title); $title = preg_replace("/[^\w ]/", "", $title); $title = str_replace(" ", "-", $title); $title = str_replace("--", "-", $title); diff --git a/engine/tests/regression/trac_bugs.php b/engine/tests/regression/trac_bugs.php index 2bfc37558..99cf81774 100644 --- a/engine/tests/regression/trac_bugs.php +++ b/engine/tests/regression/trac_bugs.php @@ -45,7 +45,7 @@ class ElggCoreRegressionBugsTest extends ElggCoreUnitTest { /** * #1558 */ - public function testElggObjectClearAnnotations() { + public function testElggObjectDeleteAnnotations() { $this->entity = new ElggObject(); $guid = $this->entity->save(); |