top-think / top-think/think-orm

2.0版本里的问题,substr_replace要求传入的要保存的数组里每个成员都是字符串

Open
#451 1 comment 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

Uncaught TypeError: substr_replace(): Argument #2 ($replace) must be of type array|string, int given in .\vendor\topthink\think-orm\src\db\Connection.php:1322

$new['status']='0'; // 这样才可以,但我库里定义的就是int类型,不是字符串

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 vendor/topthink/think-orm/src/db/Connection.php:1322 and reproduce the error with an integer status value such as 0, comparing it with the string value '0'. Trace the value passed to substr_replace and consider the issue complete when integer-valued updates no longer trigger this TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.