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

Only Final Content-Type Should Be Used #1

Closed
rmccue opened this issue Sep 29, 2009 · 1 comment
Closed

Only Final Content-Type Should Be Used #1

rmccue opened this issue Sep 29, 2009 · 1 comment

Comments

@rmccue
Copy link
Contributor

rmccue commented Sep 29, 2009

Originally reported by Geoffrey Sneddon as issue 1

For compatibility with the real web, we need to only take the final Content-Type header, and not concatenate them (which is technically the correct behaviour according to RFC2616, it's just totally useless in the real world).

@rmccue
Copy link
Contributor Author

rmccue commented Dec 11, 2010

Fixed in 89e4771

detrax referenced this issue in detrax/simplepie Mar 26, 2015
mblaney pushed a commit that referenced this issue May 15, 2016
Alkarex added a commit to Alkarex/simplepie that referenced this issue Aug 28, 2016
Alkarex referenced this issue in FreshRSS/simplepie Jan 29, 2021
#fix FreshRSS/FreshRSS#3401 (crash with PHP
8+)

Use `!empty` instead of `isset()` to properly handle falsy values such
as empty string, 0, false, null.
While 0 would be grammatically fine in some cases, it does not make
sense for a media length or height, or width or framerate or bitrate.

Example with feed http://podcast.hr2.de/derTag/podcast.xml

```xml
<enclosure
url="https://mp3podcasthr-a.akamaihd.net:443/mp3/podcast/derTag/derTag_20210129_87093232.mp3"
length="" type="audio/mpeg"/>
```

`isset("")` passes and then `ceil("")` crashes due to wrong type in
PHP8+:

```
Uncaught TypeError: ceil(): Argument #1 ($num) must be of type
int|float, string given in ./SimplePie/SimplePie/Item.php:2871
```

`!empty()` fixes the problem.
Alkarex referenced this issue in FreshRSS/simplepie Jan 30, 2021
`ceil()` crashes in PHP8+ in case of invalid input such as empty string.
`intval()` fixes the problem with almost identical beahviour than
`ceil()` in PHP7- (except for flotting point values)

#fix FreshRSS/FreshRSS#3401 (crash with PHP
8+)

Example with feed http://podcast.hr2.de/derTag/podcast.xml

```xml
<enclosure

url="https://mp3podcasthr-a.akamaihd.net:443/mp3/podcast/derTag/derTag_20210129_87093232.mp3"
length="" type="audio/mpeg"/>
```

`isset("")` passes and then `ceil("")` crashes due to wrong type in
PHP8+:

```
Uncaught TypeError: ceil(): Argument #1 ($num) must be of type
int|float, string given in ./SimplePie/SimplePie/Item.php:2871
```
mblaney pushed a commit that referenced this issue Jan 31, 2021
`ceil()` crashes in PHP8+ in case of invalid input such as empty string.
`intval()` fixes the problem with almost identical beahviour than
`ceil()` in PHP7- (except for flotting point values)

#fix FreshRSS/FreshRSS#3401 (crash with PHP
8+)

Example with feed http://podcast.hr2.de/derTag/podcast.xml

```xml
<enclosure

url="https://mp3podcasthr-a.akamaihd.net:443/mp3/podcast/derTag/derTag_20210129_87093232.mp3"
length="" type="audio/mpeg"/>
```

`isset("")` passes and then `ceil("")` crashes due to wrong type in
PHP8+:

```
Uncaught TypeError: ceil(): Argument #1 ($num) must be of type
int|float, string given in ./SimplePie/SimplePie/Item.php:2871
```
Alkarex referenced this issue in FreshRSS/simplepie Mar 20, 2021
Fix
```
PHP Fatal error:  Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /SimplePie/Locator.php:83
```

`set_error_handler` does not catch ValueError in PHP8
The code is compatible PHP5 and PHP7.

Fix downstream bug FreshRSS/FreshRSS#3537
Downstream PR FreshRSS/FreshRSS#3547
mblaney pushed a commit that referenced this issue Mar 23, 2021
Fix
```
PHP Fatal error:  Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /SimplePie/Locator.php:83
```

`set_error_handler` does not catch ValueError in PHP8
The code is compatible PHP5 and PHP7.

Fix downstream bug FreshRSS/FreshRSS#3537
Downstream PR FreshRSS/FreshRSS#3547
jrfnl added a commit to jrfnl/simplepie that referenced this issue Aug 10, 2021
As of PHP 8.1, passing `null` to non-nullable arguments of PHP native functions is deprecated.
Ref: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

The `SimplePie_Enclosure::get_extension()` returns the file extension as a string or `null`.

In the `SimplePie_Enclosure::get_real_type()` method, the return value of a call to the `get_extension()` method was directly passed on to the PHP native `strtolower()` function, leading to the PHP 8.1 `strtolower(): Passing null to parameter simplepie#1 ($string) of type string is deprecated` deprecation notice.

This small change fixes this issue without BC break.

This is covered by 36 of the existing tests in the `OldTest` class.
jrfnl added a commit to jrfnl/simplepie that referenced this issue Aug 14, 2021
As of PHP 8.1, passing `null` to non-nullable arguments of PHP native functions is deprecated.
Ref: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

The `SimplePie_Enclosure::get_extension()` returns the file extension as a string or `null`.

In the `SimplePie_Enclosure::get_real_type()` method, the return value of a call to the `get_extension()` method was directly passed on to the PHP native `strtolower()` function, leading to the PHP 8.1 `strtolower(): Passing null to parameter simplepie#1 ($string) of type string is deprecated` deprecation notice.

This small change fixes this issue without BC break.

This is covered by 36 of the existing tests in the `OldTest` class.
mblaney pushed a commit that referenced this issue Aug 14, 2021
As of PHP 8.1, passing `null` to non-nullable arguments of PHP native functions is deprecated.
Ref: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

The `SimplePie_Enclosure::get_extension()` returns the file extension as a string or `null`.

In the `SimplePie_Enclosure::get_real_type()` method, the return value of a call to the `get_extension()` method was directly passed on to the PHP native `strtolower()` function, leading to the PHP 8.1 `strtolower(): Passing null to parameter #1 ($string) of type string is deprecated` deprecation notice.

This small change fixes this issue without BC break.

This is covered by 36 of the existing tests in the `OldTest` class.

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
@Art4 Art4 mentioned this issue Mar 15, 2023
jtojnar added a commit to jtojnar/simplepie that referenced this issue Jun 8, 2023
In psr/simple-cache < 2.0.0, which is installed on PHP 7.4 or lower,
the `Psr\SimpleCache\InvalidArgumentException` interface does not extend `Throwable`.
But the current versions of PHPUnit require subtypes of `Throwable` to be given to `expectException()` method.
As a result, PHPStan will complain when we try to expect the non-`Throwable`-inheriting interface:

    Parameter simplepie#1 $exception of method PHPUnit\Framework\TestCase::expectException() expects class-string<Throwable>, string given.
jtojnar added a commit to jtojnar/simplepie that referenced this issue Aug 6, 2023
In psr/simple-cache < 2.0.0, which is installed on PHP 7.4 or lower,
the `Psr\SimpleCache\InvalidArgumentException` interface does not extend `Throwable`.
But the current versions of PHPUnit require subtypes of `Throwable` to be given to `expectException()` method.
As a result, PHPStan will complain when we try to expect the non-`Throwable`-inheriting interface:

    Parameter simplepie#1 $exception of method PHPUnit\Framework\TestCase::expectException() expects class-string<Throwable>, string given.
mblaney pushed a commit to jtojnar/simplepie that referenced this issue Aug 8, 2023
In psr/simple-cache < 2.0.0, which is installed on PHP 7.4 or lower,
the `Psr\SimpleCache\InvalidArgumentException` interface does not extend `Throwable`.
But the current versions of PHPUnit require subtypes of `Throwable` to be given to `expectException()` method.
As a result, PHPStan will complain when we try to expect the non-`Throwable`-inheriting interface:

    Parameter simplepie#1 $exception of method PHPUnit\Framework\TestCase::expectException() expects class-string<Throwable>, string given.
jtojnar added a commit to jtojnar/simplepie that referenced this issue Aug 8, 2023
In psr/simple-cache < 2.0.0, which is installed on PHP 7.4 or lower,
the `Psr\SimpleCache\InvalidArgumentException` interface does not extend `Throwable`.
But the current versions of PHPUnit require subtypes of `Throwable` to be given to `expectException()` method.
As a result, PHPStan will complain when we try to expect the non-`Throwable`-inheriting interface:

    Parameter simplepie#1 $exception of method PHPUnit\Framework\TestCase::expectException() expects class-string<Throwable>, string given.
jtojnar added a commit to jtojnar/simplepie that referenced this issue Aug 8, 2023
In psr/simple-cache < 2.0.0, which is installed on PHP 7.4 or lower,
the `Psr\SimpleCache\InvalidArgumentException` interface does not extend `Throwable`.
But the current versions of PHPUnit require subtypes of `Throwable` to be given to `expectException()` method.
As a result, PHPStan will complain when we try to expect the non-`Throwable`-inheriting interface:

    Parameter simplepie#1 $exception of method PHPUnit\Framework\TestCase::expectException() expects class-string<Throwable>, string given.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant