Opened 3 years ago
Closed 3 years ago
#12209 closed defect (bug) (invalid)
Syntax errors in filters
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Administration | Version: | |
| Severity: | normal | Keywords: | filter, variable, syntax |
| Cc: |
Description
Could be wrong, but should the "$" be inside the curly braces or does it matter?
Line 536:
$actions = apply_filters("${taxonomy}_row_actions", $actions, $tag);
Line 564:
apply_filters("manage_${taxonomy}_custom_column", , $column_name, $tag->term_id);
https://core.trac.wordpress.org/browser/trunk/wp-admin/includes/template.php
Change History (3)
nacin - Thanks for the info! I have never seen anything like this before so was prompted to ask.
- Resolution set to invalid
- Status changed from new to closed
It does look weird at first if you've never seen it. But it is syntactically correct.
It reduces errors too, take this for example:
"${bar}_test"
"{$bar}_test"
"$bar_test"
//Ok, All those look sane, now try:
"${bar_foo_result}_taz"
"{$bar_foo_result}_taz"
"$bar_foo_result_taz"
The braces just make it that much more clearer that the variable name is held within, and that the braces will not appear in the final string..

It looks weird, but it works. It's a way to define a variable variable.
$foo = 'bar'; $baz = "${foo}"; var_dump( $baz ); // string(3) "bar" $baz = "{$foo}"; var_dump( $baz ); // string(3) "bar"Based on a real quick test, it appears to be a negligible difference in performance.