Opened 11 years ago
Closed 9 years ago
#25462 closed defect (bug) (fixed)
set_group fails on deregistered but not dequeued
Reported by: | tivnet | Owned by: | chriscct7 |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Script Loader | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
This:
add_action('wp_print_scripts', function () { wp_deregister_script('autosave'); });
results in:
PHP Notice: Undefined index: autosave in class.wp-scripts.php on line 169 PHP Notice: Trying to get property of non-object in class.wp-scripts.php on line 169
With wp_dequeue_script('autosave');
, everything is fine.
But without dequeue
, probably, the attached patch might help.
Attachments (2)
Change History (8)
#2
@
11 years ago
Appears to be a duplicate of #20912 (which has the same use case and the same patch).
#3
@
11 years ago
- Component changed from Warnings/Notices to Script Loader
- Keywords 2nd-opinion added
Hm. #20912 was closed.
#4
@
11 years ago
I checked again, with 3.8 - and there was no warning.
However, theoretically, args
can be null
public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { if ( isset($this->registered[$handle]) ) return false; $this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args ); return true; }
So, checking for if ( $this->registered[$handle]->args === 1 )
may produce warnings.
I believe, the code will be safer with the patch.
Note: See
TracTickets for help on using
tickets.
@nacin
Any resolution on this? Thank you!