top-think / top-think/think-orm

关于实体模型自动查找模型的问题

Open
#846 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
437
Forks
188
PR merge metrics
No merged PRs in 30d

Description

在 think-orm/src/Entity.php: 53-54中,通过替换命名空间来实现自动查找模型类,把\entity\替换为了\model\。
多数情况下没有问题,但是在我们项目中,命名空间是\entity\User和\model\User,这就导致替换失败,$class还是当前类,运行时无限的初始化,最终内存不足。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at think-orm/src/Entity.php lines 53-54 and inspect how the entity namespace is converted to a model namespace. Reproduce the case where Entity\User and Model\User use the stated namespaces, then verify that model lookup no longer resolves back to the entity or repeatedly initializes until memory is exhausted.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.