[Bug]: "Trying to access array offset on null" on text 'null' value
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start in src/Editor.php at getContentType and follow the value into src/Core/Schema.php around line 70. Reproduce the failure with SetContent using the text "null", then run the existing test suite and add a regression test if the relevant test location is available. Done means the literal text "null" can be edited without an exception.
Written by the indexing model from the issue text.
Description
PHP Version
8.4.3
Version
2.0.0
Bug Description
Setting content with SetContent to text 'null' throws an error "Trying to access array offset on null" in vendor\\ueberdosis\\tiptap-php\\src\\Core\\Schema.php:70
Its because in https://github.com/ueberdosis/tiptap-php/blob/2.0.0/src/Editor.php#L45
getContentType is called https://github.com/ueberdosis/tiptap-php/blob/2.0.0/src/Editor.php#L96
and verifies the value using json_decode, but this accepts literal 'null' text as valid null
So in turn apply will get a null document https://github.com/ueberdosis/tiptap-php/blob/2.0.0/src/Core/Schema.php#L70
and throw
Expected Behavior
Be able to edit any text value, including 'null'
Additional Context (Optional)
I only found about this by chance using laravel filament RichEditor that is using this package under the hood.
The input data is external and imported to db, and there was some 'null' text in some of the fields.
Thats why there is also ready to test filament repo with this case as it was reported as filament issue here https://github.com/filamentphp/filament/issues/18216 but closed due the issue being in the package
Dependency Updates
- Yes, I've updated all my dependencies.
- Dominant language
- PHP
- Stars
- 278
- Forks
- 46
- Avg merge
- 4m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ueberdosis/tiptap-php
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ueberdosis/tiptap-php#91 · 1 comment ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 48/100
ueberdosis/tiptap-php#90 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 50/100
ueberdosis/tiptap-php#89 · 1 comment ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
ueberdosis/tiptap-php#87 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
ueberdosis/tiptap-php#86 ·
All issues in ueberdosis/tiptap-php
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·