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

Doesn't check for message_logger to exist before logging #45

Open
eduardoarandah opened this issue Feb 15, 2017 · 1 comment
Open

Doesn't check for message_logger to exist before logging #45

eduardoarandah opened this issue Feb 15, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@eduardoarandah
Copy link

eduardoarandah commented Feb 15, 2017

Got this fatal error:

[15-Feb-2017 14:12:52 UTC] PHP Fatal error:  Uncaught Error: Call to a member function log() on null in PATH_HERE/plugins/bwp-google-xml-sitemaps/src/class-bwp-gxs.php:2545
Stack trace:
#0 PATH_HERE/plugins/bwp-google-xml-sitemaps/src/class-bwp-gxs.php(2573): BWP_Sitemaps->_log_message_item('Pinged <em>Goog...', 'success')
#1 PATH_HERE/plugins/bwp-google-xml-sitemaps/src/class-bwp-gxs.php(2603): BWP_Sitemaps->log_message('Pinged <em>Goog...', 'success')
#2 PATH_HERE/plugins/bwp-google-xml-sitemaps/src/class-bwp-gxs.php(3961): BWP_Sitemaps->log_success('Pinged <em>Goog...')
#3 /srv/users/serverpilot/apps/veracruzanos/public/wp-includes/class-wp-hook.php(298): BWP_Sitemaps->ping(Object(WP_Post))
#4 /srv/users/serverpilot/apps/veracruzanos/public/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
#5 /srv/users/serverpilot/apps/veracruzanos/publi in PATH_HERE/plugins/bwp-google-xml-sitemaps/src/class-bwp-gxs.php on line 2545

In function _log_message_item there's a call to an object before checking it exists:

$this->message_logger->log($item);

maybe this could prevent the error? (I haven't tested)

if(isset($this->message_logger))
    $this->message_logger->log($item);
@kminh
Copy link
Collaborator

kminh commented Jul 1, 2017

@kminh kminh added the Bug label Nov 10, 2017
@kminh kminh self-assigned this Nov 10, 2017
@kminh kminh added this to the 1.4.2 milestone Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants