PublishPress-Planner icon indicating copy to clipboard operation
PublishPress-Planner copied to clipboard

get_plugin_data fail when PLUGIN_BASENAME is not yet defined

Open andergmartins opened this issue 5 years ago • 0 comments

https://publishpress.slack.com/archives/CG676C66A/p1571082081004600

Here's another EDD integration issue (and workaround) I noticed on my localhost: This seems due to the container's 'PLUGIN_BASENAME' array element not being set prior to the get_plugin_data() call.

I can work around it this way:

if (!defined('PRESSPERMIT_DEBUG')) {
      $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $c['PLUGIN_BASENAME']);
 } else {
      return 'PublishPress Multiple Authors';
 }

The EDD warnings:

Warning: fopen(F:\www\wp50/wp-content/plugins/publishpress-multiple-authors): failed to open stream: Permission denied in F:\www\wp50\wp-includes\functions.php on line 5568
Call Stack
#	Time	Memory	Function	Location
1	0.4017	453816	{main}( )	...\plugins.php:0
2	0.4025	526368	require_once( 'F:\www\wp50\wp-admin\admin.php' )	...\plugins.php:10
3	0.4028	546656	require_once( 'F:\www\wp50\wp-load.php' )	...\admin.php:34
4	0.4032	569120	require_once( 'F:\www\wp50\wp-config.php' )	...\wp-load.php:37
5	0.4040	750944	require_once( 'F:\www\wp50\wp-settings.php' )	...\wp-config.php:141
6	0.6232	29014328	include_once( 'F:\www\wp50\wp-content\plugins\publishpress-multiple-authors\publishpress-multiple-authors.php' )	...\wp-settings.php:362
7	0.6557	31649456	MultipleAuthors\Plugin->__construct( )	...\publishpress-multiple-authors.php:71
8	0.6558	31651888	Pimple\Container->offsetGet( )	...\publishpress-multiple-authors.php:56
9	0.6558	31651936	MultipleAuthors\Services->MultipleAuthors\{closure}( )	...\Container.php:118
10	0.6566	31676936	Allex\Core->__construct( )	...\Services.php:104
11	0.6783	32814496	Allex\Core->get_service( )	...\Core.php:65
12	0.6783	32814496	Pimple\Container->offsetGet( )	...\Core.php:104
13	0.6783	32814528	Allex\Container->Allex\{closure}( )	...\Container.php:118
14	0.6794	32845520	Allex\Module\Upgrade->__construct( )	...\Container.php:188
15	0.6795	32845456	Pimple\Container->offsetGet( )	...\Container.php:50
16	0.6795	32845512	Allex\Container->Allex\{closure}( )	...\Container.php:118
17	0.6795	32845728	get_plugin_data( )	...\Container.php:109
18	0.6795	32848008	get_file_data( )	...\plugin.php:84
19	0.6795	32848136	fopen ( )	...\functions.php:5568

Warning: fread() expects parameter 1 to be resource, boolean given in F:\www\wp50\wp-includes\functions.php on line 5571
Call Stack
#	Time	Memory	Function	Location
1	0.4017	453816	{main}( )	...\plugins.php:0
2	0.4025	526368	require_once( 'F:\www\wp50\wp-admin\admin.php' )	...\plugins.php:10
3	0.4028	546656	require_once( 'F:\www\wp50\wp-load.php' )	...\admin.php:34
4	0.4032	569120	require_once( 'F:\www\wp50\wp-config.php' )	...\wp-load.php:37
5	0.4040	750944	require_once( 'F:\www\wp50\wp-settings.php' )	...\wp-config.php:141
6	0.6232	29014328	include_once( 'F:\www\wp50\wp-content\plugins\publishpress-multiple-authors\publishpress-multiple-authors.php' )	...\wp-settings.php:362
7	0.6557	31649456	MultipleAuthors\Plugin->__construct( )	...\publishpress-multiple-authors.php:71
8	0.6558	31651888	Pimple\Container->offsetGet( )	...\publishpress-multiple-authors.php:56
9	0.6558	31651936	MultipleAuthors\Services->MultipleAuthors\{closure}( )	...\Container.php:118
10	0.6566	31676936	Allex\Core->__construct( )	...\Services.php:104
11	0.6783	32814496	Allex\Core->get_service( )	...\Core.php:65
12	0.6783	32814496	Pimple\Container->offsetGet( )	...\Core.php:104
13	0.6783	32814528	Allex\Container->Allex\{closure}( )	...\Container.php:118
14	0.6794	32845520	Allex\Module\Upgrade->__construct( )	...\Container.php:188
15	0.6795	32845456	Pimple\Container->offsetGet( )	...\Container.php:50
16	0.6795	32845512	Allex\Container->Allex\{closure}( )	...\Container.php:118
17	0.6795	32845728	get_plugin_data( )	...\Container.php:109
18	0.6795	32848008	get_file_data( )	...\plugin.php:84
19	0.7909	32849496	fread ( )	...\functions.php:5571

Warning: fclose() expects parameter 1 to be resource, boolean given in F:\www\wp50\wp-includes\functions.php on line 5574
Call Stack
#	Time	Memory	Function	Location
1	0.4017	453816	{main}( )	...\plugins.php:0
2	0.4025	526368	require_once( 'F:\www\wp50\wp-admin\admin.php' )	...\plugins.php:10
3	0.4028	546656	require_once( 'F:\www\wp50\wp-load.php' )	...\admin.php:34
4	0.4032	569120	require_once( 'F:\www\wp50\wp-config.php' )	...\wp-load.php:37
5	0.4040	750944	require_once( 'F:\www\wp50\wp-settings.php' )	...\wp-config.php:141
6	0.6232	29014328	include_once( 'F:\www\wp50\wp-content\plugins\publishpress-multiple-authors\publishpress-multiple-authors.php' )	...\wp-settings.php:362
7	0.6557	31649456	MultipleAuthors\Plugin->__construct( )	...\publishpress-multiple-authors.php:71
8	0.6558	31651888	Pimple\Container->offsetGet( )	...\publishpress-multiple-authors.php:56
9	0.6558	31651936	MultipleAuthors\Services->MultipleAuthors\{closure}( )	...\Container.php:118
10	0.6566	31676936	Allex\Core->__construct( )	...\Services.php:104
11	0.6783	32814496	Allex\Core->get_service( )	...\Core.php:65
12	0.6783	32814496	Pimple\Container->offsetGet( )	...\Core.php:104
13	0.6783	32814528	Allex\Container->Allex\{closure}( )	...\Container.php:118
14	0.6794	32845520	Allex\Module\Upgrade->__construct( )	...\Container.php:188
15	0.6795	32845456	Pimple\Container->offsetGet( )	...\Container.php:50
16	0.6795	32845512	Allex\Container->Allex\{closure}( )	...\Container.php:118
17	0.6795	32845728	get_plugin_data( )	...\Container.php:109
18	0.6795	32848008	get_file_data( )	...\plugin.php:84
19	0.9023	32849544	fclose ( )	...\functions.php:5574

andergmartins avatar Oct 31 '19 14:10 andergmartins