Skip to content

Commit

Permalink
split content-type and get real mime type
Browse files Browse the repository at this point in the history
Nowadays there could be content-types like “text/xml; charset=utf-8
which doesn’t match to ”text/xml” at all. This splits from ; and takes
first element and does the comparison using that instead.
  • Loading branch information
Smarre committed Dec 19, 2012
1 parent e9254e5 commit 8d56926
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PEAR/REST.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ function retrieveData($url, $accept = false, $forcestring = false, $channel = fa
}

if (isset($headers['content-type'])) {
switch ($headers['content-type']) {
$content_type = explode(";", $headers['content-type']);
$content_type = $content_type[0];
switch ($content_type) {
case 'text/xml' :
case 'application/xml' :
case 'text/plain' :
if ($headers['content-type'] === 'text/plain') {
if ($content_type === 'text/plain') {
$check = substr($content, 0, 5);
if ($check !== '<?xml') {
break;
Expand Down

6 comments on commit 8d56926

@sinkcup
Copy link

Choose a reason for hiding this comment

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

have this version released? I have installed PEAR 1.9.4, but that file is still old.

@cweiske
Copy link
Member

Choose a reason for hiding this comment

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

@sinkcup: no, not released

@sinkcup
Copy link

Choose a reason for hiding this comment

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

... a year ago ... is PEAR been deprecated ?

@sad-spirit
Copy link
Member

Choose a reason for hiding this comment

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

No, we are trying to clean up the mess and release 1.10 sometime (hopefully) soon.

@CloCkWeRX
Copy link
Member

@CloCkWeRX CloCkWeRX commented on 8d56926 Apr 15, 2014 via email

Choose a reason for hiding this comment

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

@cweiske
Copy link
Member

@cweiske cweiske commented on 8d56926 Jun 2, 2014

Choose a reason for hiding this comment

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

Cherry-picked into stable branch for version 1.9.5.

Please sign in to comment.