Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add support for older PHP 5.x.x versions #14

Merged
merged 1 commit into from

2 participants

@por

This PR adds support for older PHP 5 versions (<5.3.0). Older versions threw the following error when including the main Soundcloud.php library file.

syntax error, unexpected T_FUNCTION, expecting ')' in /path/to/Soundcloud.php

This is also described in this StackOverflow question.

The root cause is that array_map only supports lambda functions as of PHP 5.0.3. This PR replaces this method with a simple foreach.

@mptre mptre merged commit d30406a into mptre:master
@mptre
Owner

Thx, merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 17, 2013
  1. @por
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 Services/Soundcloud.php
View
8 Services/Soundcloud.php
@@ -717,9 +717,11 @@ function download($trackId, $params = array(), $curlOptions = array())
public function updatePlaylist($playlistId, $trackIds, $optionalPostData = null)
{
$url = $this->_buildUrl('playlists/' . $playlistId);
- $postData = array_map(function ($track) {
- return 'playlist[tracks][][id]=' . $track;
- }, $trackIds);
+
+ $postData = array();
+ foreach ($trackIds as $trackId) {
+ $postData[] = 'playlist[tracks][][id]=' . $trackId;
+ }
if (is_array($optionalPostData)) {
foreach ($optionalPostData as $key => $val) {
Something went wrong with that request. Please try again.