Browse Source

For SonataDoctrineMongoDb, a MongoId is not numeric but hexadecimal. The test is_numeric() fails in method Admin::getSubject()

Replaced by a preg_match. Could use ctype_xdigit too (matter of taste)

Florent Genette 13 years ago
parent
commit
5c33226d1f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Admin/Admin.php

+ 1 - 1
Admin/Admin.php

@@ -1342,7 +1342,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
     {
         if ($this->subject === null && $this->request) {
             $id = $this->request->get($this->getIdParameter());
-            if (!is_numeric($id)) {
+            if (!preg_match('#^[0-9A-Fa-f]+$#', $id)) {
                 $this->subject = false;
             } else {
                 $this->subject = $this->getModelManager()->find($this->getClass(), $id);