Hi
I'm getting the following error message:

Notice: Trying to get property of non-object in theme_soundcloud_filter_embed_html5() (line 249 of /srv/www/xxxxxx.com/public_html/sites/all/modules/soundcloud_filter/soundcloud_filter.module).

Comments

b3nji’s picture

Status: Active » Closed (works as designed)

Update: Error was due to Soundcloud outage. All is well again.

b3nji’s picture

Priority: Critical » Minor
Status: Closed (works as designed) » Active

Reopened. Message is still appearing.

Additionally getting these two error messages at the same time:

Warning: simplexml_load_string(): in theme_soundcloud_filter_embed_html5() (line 246 of /srv/www/xxxxxx.com/public_html/sites/all/modules/soundcloud_filter/soundcloud_filter.module).

Warning: simplexml_load_string(): ^ in theme_soundcloud_filter_embed_html5() (line 246 of /srv/www/xxxxxx.com/public_html/sites/all/modules/soundcloud_filter/soundcloud_filter.module).

kalman.hosszu’s picture

Status: Active » Postponed (maintainer needs more info)

Could you print what are $oembed_url and $oembed variables? You can print it via print_r() or var_dump() etc functions.

_paul_meta’s picture

Same issue here. I'm using ckeditor as a text editor, not sure if that makes a difference.

even a simple use of the soundcloud filter (no additional value options, just the url) causes this issue, and i get 4 error messages.

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found in theme_soundcloud_filter_embed_html5() (line 246 of /home/xxxxx/public_html/sites/all/modules/soundcloud_filter/soundcloud_filter.module).

Warning: simplexml_load_string() [function.simplexml-load-string]: in theme_soundcloud_filter_embed_html5() (line 246 of /home/xxxxx/public_html/sites/all/modules/soundcloud_filter/soundcloud_filter.module).

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in theme_soundcloud_filter_embed_html5() (line 246 of /home/xxxxx/public_html/sites/all/modules/soundcloud_filter/soundcloud_filter.module).

Notice: Trying to get property of non-object in theme_soundcloud_filter_embed_html5() (line 249 of /home/xxxxx/public_html/sites/all/modules/soundcloud_filter/soundcloud_filter.module).

b3nji’s picture

Try replacing lines 235-275 in soundcloud_filter.module with this code (sorry I don't know how to write patches)

/**
 * Function that outputs the HTML5 player
 */
function theme_soundcloud_filter_embed_html5($variables) {
  $output = '';

  $soundcloud = $variables['sound'];
  $oembed_endpoint = 'http://soundcloud.com/oembed';
  $encoded_url = urlencode($soundcloud['url']);

  $oembed_url = $oembed_endpoint . '?iframe=true&url=' . ($encoded_url);
  
  // curl get
  $soundcloud_curl_get = soundcloudfield_curl_get($oembed_url);
  
  if ($soundcloud_curl_get != ' ') {
	  // Load in the oEmbed XML
	  $oembed = simplexml_load_string(soundcloud_filter_curl_get($oembed_url));

	  // Replace player default settings with our settings
	  $final_iframe = preg_replace('/(width=)"([^"]+)"/', 'width="' . $soundcloud['width'] . '%"', $oembed->html);

	  if (preg_match('/auto_play=(true|false)/', $final_iframe)) {
		$final_iframe = preg_replace('/auto_play=(true|false)/', 'auto_play=' . $soundcloud['autoplay'], $final_iframe);
	  }
	  else {
		$final_iframe = preg_replace('/">/', '&auto_play=' . $soundcloud['autoplay'] . '">', $final_iframe);
	  }

	  if (preg_match('/show_artwork=(true|false)/', $final_iframe)) {
		$final_iframe = preg_replace('/show_artwork=(true|false)/', 'show_artwork=' . $soundcloud['showartwork'], $final_iframe);
	  }
	  else {
		$final_iframe = preg_replace('/">/', '&show_artwork=' . $soundcloud['showartwork'] . '">', $final_iframe);
	  }

	  if (preg_match('/color=([a-zA-Z0-9]{6})/', $final_iframe)) {
		$final_iframe = preg_replace('/color=([a-zA-Z0-9]{6})/', 'color=' . $soundcloud['color'], $final_iframe);
	  }
	  else {
		$final_iframe = preg_replace('/">/', '&color=' . $soundcloud['color'] . '">', $final_iframe);
	  }

	  $output = html_entity_decode($final_iframe);  // '$oembed->html' for original embed
    } else {
	$output = t(' ');
    watchdog('soundcloud_filter', 'Soundcloud track does not exist.', NULL, WATCHDOG_WARNING);
    }

  return $output;
}