浏览代码

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 年之前
父节点
当前提交
5c33226d1f
共有 1 个文件被更改,包括 1 次插入1 次删除
  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);