Skip to content

Conversation

@hbh112233abc
Copy link
Contributor

在实际使用中,$value可能包含了正则的特殊字符,导致查询报错或未能达预期,因此增加判断$value是否为/.../的正则表达式,否则做一下preg_quote处理

使用mongo驱动时
`think\model\concern\DbConnect`
第40行需要调用mongo的自动递增主键的方法,会报方法不存在的错误, 补充了这3个对应方法解决此bug
Refactor 'like' query handling to escape non-regex strings before creating Regex object.
mongodb的like查询,如果$value是字符串判断是否正则表达式,否则做一下正则特殊字符转义处理,避免$value中包含了正则特殊字符,导致查询未达预期
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.06%. Comparing base (4a4988a) to head (8cb7a12).

Files with missing lines Patch % Lines
src/db/builder/Mongo.php 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##                4.0     #829   +/-   ##
=========================================
  Coverage     52.06%   52.06%           
- Complexity     3513     3514    +1     
=========================================
  Files            74       74           
  Lines          8323     8278   -45     
=========================================
- Hits           4333     4310   -23     
+ Misses         3990     3968   -22     
Flag Coverage Δ
unittests 52.06% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant