Automattic / Automattic/jetpack

VideoPress_Divi_Extension does not have a method "admin_hook_enqueue_scripts"

Open
#39,311 5 comments 0 reactions 1 assignee Claimed by @obenland View on GitHub
[Feature] VideoPress [Focus] Compatibility [Platform] Atomic [Plugin] Jetpack [Plugin] VideoPress [Pri] Low [Status] Stale Bug Customer Report [LEGACY] Triaged
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

### Impacted plugin

Jetpack, VideoPress

### Quick summary

The issue was reported as many as twice with older versions of Divi (4.2.2), where the following Fatal Error shows up when the VideoPress module is active.

### Steps to reproduce

1. Install Divi 4.2.2.
2. Have Jetpack's VideoPress module active.
3. Navigate to `wp-admin`

### A clear and concise description of what you expected to happen.

WP-Admin should work as expected.

### What actually happened

A critical error is displayed.
CLI shows the following error:

```
PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class VideoPress_Divi_Extension does not have a method "admin_hook_enqueue_scripts"
```

### Impact

Some (< 50%)

### Available workarounds?

Yes, easy to implement

### If the above answer is "Yes...", outline the workaround.

_No response_

### Platform (Simple and/or Atomic)

Atomic

### Logs or notes

The latest version of Divi appears to have been updated, so the error is less widespread. However, I'm still opening an issue after the Slack conversation here: p1725819820858299-slack-C03TY6J1A

### Notes from Mike on that Slack thread:

===
`VideoPress_Divi_Extension` is part of Jetpack to add VideoPress support in Divi. This exists in Jetpack in `jetpack/13.8/jetpack_vendor/automattic/jetpack-videopress/src/videopress-divi/class-videopress-divi-extension.php`. It seems to not be compatible with PHP 8+ as there is no function defined for `admin_hook_enqueue_scripts` , which is called during initialization. PHP 8+ is more strict about this.

Divi added `admin_hook_enqueue_scripts` to their `DiviExtension` class at some point in the last 4 years, which is what Jetpack extends.
Jetpack should still have this function defined as well to prevent the fatal in older versions of Divi, so it's still worth filing a bug report. In newer versions of Divi it is defined as this:
```
public function admin_hook_enqueue_scripts() {
if ( et_builder_bfb_enabled() || et_builder_is_tb_admin_screen() ) {
$this->_enqueue_backend_styles();
}
}
```
===

The two user-reported errors were [here](https://wordpress.com/forums/topic/divi-wordpress-com-business/?view=all#post-3997490) and 8707111-zd-a8c.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.