Skip to content

Commit

Permalink
Fix php-8.2 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
alphp committed Jan 16, 2024
1 parent 7100eb1 commit 6ea4dd0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
}
],
"require": {
"php": ">=7.2"
"php": ">=7.2",
"ext-mbstring": "*"
},
"suggest": {
"ext-openssl": "*",
Expand Down
10 changes: 9 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true" cacheResultFile=".phpunit.cache">
<phpunit
bootstrap="vendor/autoload.php"
colors="true"
cacheResultFile=".phpunit.cache"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<php>
<const name="_DEBUG_LEVEL" value="0"/>
</php>
Expand Down
2 changes: 1 addition & 1 deletion scripts/PDFBookmark/PDFBookmarkTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trait PDFBookmarkTrait {
*/
public function Bookmark (string $txt, bool $isUTF8 = false, int $level = 0, float $y = 0) : void {
if(!$isUTF8)
$txt = utf8_encode($txt);
$txt = mb_convert_encoding($txt, 'UTF-8', 'ISO-8859-1');
if($y==-1)
$y = $this->GetY();
$this->outlines[] = array('t'=>$txt, 'l'=>$level, 'y'=>($this->h-$y)*$this->k, 'p'=>$this->PageNo());
Expand Down
1 change: 1 addition & 0 deletions scripts/PDFMemImage/VariableStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

// Stream handler to read from global variables
class VariableStream {
public $context;
private $varname;
private $position;

Expand Down
2 changes: 2 additions & 0 deletions scripts/PDFProtection/PDFProtectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

trait PDFProtectionTrait {
protected $encrypted = false; //whether document is protected
protected $padding;
protected $encryption_key;
protected $Uvalue; //U entry in pdf document
protected $Ovalue; //O entry in pdf document
protected $Pvalue; //P entry in pdf document
Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ public function assertFileWasCreated (string $filename, string $message = '') :
}
}

private static function rebuildPdf(string $content){
$real_content = \ctype_print($content) && @\file_exists($content)
? \file_get_contents(realpath($content)) : $content;
private static function rebuildPdf (string $content) {
$real_content = (ctype_print($content) and @file_exists($content)) ? file_get_contents(realpath($content)) : $content;

$pdf = PDFDoc::from_string($real_content);

Expand Down

0 comments on commit 6ea4dd0

Please sign in to comment.