Opened 3 years ago
Closed 11 months ago
#54827 closed defect (bug) (invalid)
Elemtentor, pagina
Reported by: | flashprice2020 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | has-patch has-unit-tests php80 changes-requested close reporter-feedback |
Focuses: | Cc: |
Description
Avvertimento : count(): il parametro deve essere un array o un oggetto che implementa Countable in /home/flashpri/public_html/wp-includes/formatting.php on line 3366
Ciao quando inserisco un file SVG non viene visualizzata la pagina creata con Elementor mi potreste aiutare ad indicarmi come faccio a cambiare il paramentro in Array o Implementare Countable
grazie anticipatamente
Attachments (1)
Change History (12)
#1
@
3 years ago
- Component changed from Plugins to Formatting
- Keywords needs-design removed
- Milestone changed from Awaiting Review to 6.0
- Severity changed from critical to normal
- Type changed from feature request to defect (bug)
This ticket was mentioned in PR #2172 on WordPress/wordpress-develop by costdev.
3 years ago
#2
- Keywords has-patch added
Guard against $matches
being null
.
Trac ticket: https://core.trac.wordpress.org/ticket/54827
#4
@
3 years ago
- Keywords has-unit-tests added
The PR to guard against non-array values for $matches
is ready for review.
This ticket was mentioned in Slack in #core by costdev. View the logs.
3 years ago
#6
@
3 years ago
- Keywords commit added; reporter-feedback removed
Per the discussion in the bug scrub, I'm adding the commit
keyword for commit consideration.
#7
@
3 years ago
- Keywords php80 added
More than anything, this needs a backtrace of what is causing the error and fixing in the actual problem code, not here.
I'm not strongly opposed to adding the extra defensive code in the function, but it would hide an error which in all truth should be fixed elsewhere.
#8
@
3 years ago
- Keywords commit removed
- Milestone changed from 6.0 to Future Release
Let's hold for now given the discussion above.
If the bug is in convert_smilies()
then, yes, it would be good to fix it there.
@hellofromTonya commented on PR #2172:
17 months ago
#9
The function _expects_ to receive an array
. It's documented as requiring an array
. Thus passing it any other data type is doing it wrong.
The guard added hides the problem if anything other than array
is passed to translate_smiley()
. The new guard clause change is actually doing input validation of the parameter.
There's a broad architectural discussion happening (the Trac ticket number escapes me) about how to handle input validation throughout the code base. Rather than implementing an isolated fix here, IMO this PR should wait and be included as part of that system-wide architectural change.
#10
@
16 months ago
- Keywords changes-requested close reporter-feedback added
More than anything, this needs a backtrace of what is causing the error and fixing in the actual problem code, not here.
I agree.
After evaluating, I am not adding the php-compatibility
focus. Why? This ticket seems to be something outside of Core doing it wrong, rather than an incompatibility with PHP 8.0. The code expects and is documented as expected an array
. Passing it anything else is doing it wrong.
I agree with @jrf about adding defensive code to protect Core's source code. However, I think the topic of input (parameter/property) validation is more of an architectural consideration, one that should be discussed and considered for application across all of Core, rather than in individual functions.
I'm inclined to close this ticket. Why?
- The root cause does not appear to be Core. Thus it needs to be fixed in the code that is passing something other than an
array
. - Input (parameter/property) validation is more of an architectural consideration. Rather than adding a guard in this one function for something that should not happen, I think the discussion of input validation should move to a more broad architectural discussion. Once there's consensus, then functions like this one could receive the same defensive protection that will be applied to all others.
I'm marking this ticket as close
candidate and reporter-feedback
to hopefully learn if the backtrace happened to identify which plugin, theme, or script caused it.
#11
@
11 months ago
- Milestone Future Release deleted
- Resolution set to invalid
- Status changed from new to closed
I'll close this ticket, as it's been 5 months with no report follow-up. As I previously noted, the root cause does not appear to be Core and a backtrace is needed to determine which plugin, theme, or script caused it.
Hi @flashprice2020, welcome to Trac and thanks for opening this ticket!
There are two issues here:
null
being returned frompreg_replace_callback()
due to a failure.The warning
This warning (PHP < 8) and error (PHP 8+) is caused by the following line:
$matches
assumes an array comes frompreg_replace_callback
.However,
preg_replace_callback
may returnnull
. See preg_replace_callback.A guard is needed to return an empty string if
$matches
isnull
.The failure
This is trickier to track down without more information. This could be an issue with Core, with Elementor, another plugin, or your theme.
@flashprice2020: did you insert any emoticons, for example:
:-)
, into your page?Update
After visiting the website and determining the limited information above, I was not able to reproduce this error after installing all of the above (excluding One Page Checkout - Premium) and creating a page.
Awaiting
reporter-feedback
about content added so that we might determine if this is a Core issue or an issue for the support forums.