Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Notice: Undefined offset: 0 on pull content page #402

Closed
grappler opened this issue Jun 7, 2019 · 4 comments · Fixed by #703
Closed

PHP Notice: Undefined offset: 0 on pull content page #402

grappler opened this issue Jun 7, 2019 · 4 comments · Fixed by #703
Assignees
Labels
type:bug Something isn't working.
Milestone

Comments

@grappler
Copy link
Contributor

grappler commented Jun 7, 2019

Describe the bug
Notice: Undefined offset: 0 in /plugins/distributor/includes/pull-ui.php:394

There is no check if there are ANY available post types.

$connection_now->pull_post_types = \Distributor\Utils\available_pull_post_types( $connection_now, $connection_type );
$connection_now->pull_post_type = $connection_now->pull_post_types[0]['slug'];

https://github.com/10up/distributor/blob/1.4.1/includes/pull-ui.php#L394

Steps to Reproduce

  1. Go to Pull Content page wp-admin/admin.php?page=pull
  2. See PHP Notice

Expected behavior
No PHP Notice

@grappler grappler added the type:bug Something isn't working. label Jun 7, 2019
@jeffpaul
Copy link
Member

jeffpaul commented Jun 7, 2019

@grappler I'm milestoning this for our larger 2.0.0 release and will look to get it resolved then, thanks again for the feedback!

@jeffpaul jeffpaul added this to the 2.0.0 milestone Jun 7, 2019
@jeffpaul
Copy link
Member

@grappler I'm no longer seeing this PHP notice. Are you still seeing it? If so, can you confirm your WordPress, Distributor, and PHP versions?

@grappler
Copy link
Contributor Author

@jeffpaul You can force the issue by including add_filter( 'dt_available_pull_post_types', '__return_empty_array' );

@dkotter dkotter mentioned this issue Jan 22, 2021
6 tasks
@dkotter
Copy link
Collaborator

dkotter commented Jan 22, 2021

@grappler Thanks for the additional information here. I've been able to reproduce this and have a fix in place in #703

@dkotter dkotter self-assigned this Jan 22, 2021
@jeffpaul jeffpaul modified the milestones: 3.0.0, 1.6.3 Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants