Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Fixed PHP 5.6 Strict Standards Error #32

Merged
merged 6 commits into from
Jul 18, 2016
Merged

Conversation

mikeschinkel
Copy link
Contributor

When using PHP 5.6 or PHP 7.0 and debugging options as follows set on the NPR Story API plugin currently throws errors.

define( 'WP_DEBUG', true );
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

You can see the errors shown in this PDF file; look for the first two errors.

}
$transcript_body .= "<p><strong>Transcript :</strong><p>";
foreach ( $body_xml->paragraph as $paragraph ) {
$transcript_body .= ( strip_tags( $paragraph ) ) . '<p>';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds an opening <p> - are the closing </p>s added anywhere?

@benlk
Copy link
Contributor

benlk commented Jul 7, 2016

Looks good to me, with the exception of that possibly-not-closed <p>.

@benlk
Copy link
Contributor

benlk commented Jul 7, 2016

In PHP 5.3, this error still shows:

PHP Notice:  Undefined property: stdClass::$url in /vagrant/wp-content/plugins/WP-DS-NPR-API/classes/NPRAPI.php on line 164, referer: http://vagrant.dev/wp-admin/options-general.php?page=ds_npr_api_get_multi_settings

https://github.com/newclarity/nprapi-wordpress/blob/2736600801384c65604b40362ea022044e077a3f/classes/NPRAPI.php#L164 :

      if (empty($this->request->params) && !stristr($this->request->url, 'sort=')){
        $this->stories = array_reverse($this->stories);
      } 

@mikeschinkel
Copy link
Contributor Author

@benlk

PHP Notice: Undefined property: stdClass::$url...

That was outside the scope of my changes. However, 2f35137 which is now part of this PR hopefully resolves that issue?

if ( $transcript->type == 'api' ) {
$response = wp_remote_get( $transcript->value );
if ( !is_wp_error( $response ) ) {
$transcript_body .= "<p><strong>Transcript :</strong><p>";
Copy link
Contributor Author

@mikeschinkel mikeschinkel Jul 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benlk As you can see the old code did not close <p>s either!

I was trying to limit the scope of my changes to just solve the solving the "Trying to get property of non-object" errors because I know it is easier to accept fixes when they are small.

That said, I'll add another commit that should add </p> closing tag.

@benlk
Copy link
Contributor

benlk commented Jul 9, 2016

No more errors here!

@mikeschinkel
Copy link
Contributor Author

Anything else needed to merge this?

@mike-douglas mike-douglas merged commit 6cdfea4 into npr:master Jul 18, 2016
mikeschinkel added a commit to newclarity/nprapi-wordpress that referenced this pull request Aug 20, 2016
Merge pull request npr#32 from newclarity/master
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants