Skip to content
This repository was archived by the owner on Jan 25, 2021. It is now read-only.

Commit c6e066d

Browse files
committed
Compatibility with PHP 7.4
1 parent 7e851af commit c6e066d

File tree

7 files changed

+18
-12
lines changed

7 files changed

+18
-12
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ language: php
22
dist: trusty
33
sudo: false
44
php:
5-
- 7.1
65
- 7.2
76
- 7.3
7+
- 7.4
88
matrix:
99
fast_finish: true

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"files": ["bootstrap.php"]
2222
},
2323
"require": {
24-
"php": ">=5.6.0"
24+
"php": ">=7.2.0"
2525
},
2626
"archive": {
2727
"exclude": ["/.gitignore", "/.travis.yml", "/phpunit.xml", "/test"]

lib/password.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public static function hash($plaintext) {
3131
* @return boolean
3232
*/
3333
public static function isHash($hash) {
34-
return password_get_info($hash)['algo'] !== 0;
34+
$algo = password_get_info($hash)['algo'];
35+
36+
return $algo !== 0 && $algo !== null;
3537
}
3638

3739
/**

lib/str.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,9 @@ public static function utf8($string) {
636636
*/
637637
public static function stripslashes($string) {
638638
if(is_array($string)) return $string;
639-
return get_magic_quotes_gpc() ? stripslashes($string) : $string;
639+
// this was "get_magic_quotes_gpc() ? stripslashes($string) : $string",
640+
// but as magic quotes are not supported since PHP 5.4.0, this method does nothing
641+
return $string;
640642
}
641643

642644
/**

lib/toolkit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
class Toolkit {
1313

14-
public static $version = '2.5.12';
14+
public static $version = '2.5.13';
1515

1616
public static function version() {
1717
return static::$version;

test/RTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public function testSet() {
1818

1919
public function testGet() {
2020

21+
r::set('testvar', 'testvalue');
22+
2123
$this->assertEquals('testvalue', r::get('testvar'));
2224
$this->assertEquals('defaultvalue', r::get('nonexistent', 'defaultvalue'));
2325

vendors/mimereader/mimereader.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ protected function match_pattern( $pattern, $mask, $ignore ) {
537537
if ( !empty( $ignore ) ) {
538538
for ( $s = 0; $s < $seq_len; ) {
539539
// This letter should not be ignored.
540-
if ( strpos( $ignore, $sequence{$s} ) === false ) {
540+
if ( strpos( $ignore, $sequence[$s] ) === false ) {
541541
break;
542542
}
543543

@@ -547,9 +547,9 @@ protected function match_pattern( $pattern, $mask, $ignore ) {
547547

548548
// Now we will compare. If it doesn't match the mask, we return false.
549549
for ( $i = 0; $i < $pattern_len; ) {
550-
$masked_data = @$sequence{$s} & @$mask{$i};
550+
$masked_data = @$sequence[$s] & @$mask[$i];
551551

552-
if ( $masked_data !== $pattern{$i} ) {
552+
if ( $masked_data !== $pattern[$i] ) {
553553
return false;
554554
}
555555

@@ -579,7 +579,7 @@ protected function html_match_pattern( $pattern, $mask, $ignore ) {
579579
if ( !empty( $ignore ) ) {
580580
for (; $s < $seq_len; ) {
581581
// This letter should not be ignored.
582-
if ( strpos( $ignore, $sequence{$s} ) === false ) {
582+
if ( strpos( $ignore, $sequence[$s] ) === false ) {
583583
break;
584584
}
585585

@@ -589,17 +589,17 @@ protected function html_match_pattern( $pattern, $mask, $ignore ) {
589589

590590
// Now we will compare. If it doesn't match the mask, we return false.
591591
for (; $i < $pattern_len; ) {
592-
$masked_data = $sequence{$s} & $mask{$i};
592+
$masked_data = $sequence[$s] & $mask[$i];
593593

594-
if ( $masked_data !== $pattern{$i} ) {
594+
if ( $masked_data !== $pattern[$i] ) {
595595
return false;
596596
}
597597

598598
++$i; ++$s;
599599
}
600600

601601
// Mask matched. This pattern matches if the last character is tag-terminating.
602-
return strpos( self::$tag_terminating_character, $sequence{$s} );
602+
return strpos( self::$tag_terminating_character, $sequence[$s] );
603603
}
604604

605605
protected function detect_type() {

0 commit comments

Comments
 (0)