Skip to content

Commit

Permalink
Fix E_USER_ERROR deprecated on PHP 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ve3 committed Dec 10, 2024
1 parent dc184c7 commit ccdf630
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 1,489 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.phpunit.result.cache
.phpunit.result.cache
.phpunit.cache
6 changes: 4 additions & 2 deletions Rundiz/Upload/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ protected function setErrorMessage(
* Or you can call this method in case that you want to process the other uploaded file next to previous one.
*
* @param string $input_file_name The name of input file.
* @throws \InvalidArgumentException Throw errors if invalid argument type.
*/
public function setInputFileName($input_file_name)
{
Expand Down Expand Up @@ -780,6 +781,7 @@ protected function setWebSafeFileName()
* @link http://php.net/manual/en/function.finfo-file.php More info about finfo_file() function.
* @param string $input_file_name The input file name. This support only one file upload.
* @return string Return file's mime type or error message.
* @throws \InvalidArgumentException Throw errors if invalid argument type.
*/
public function testGetUploadedMimetype($input_file_name = null)
{
Expand Down Expand Up @@ -1305,7 +1307,7 @@ protected function validateImageDimension()
/**
* Validate that these options properties has properly set in the correct type.
*
* @throws Exception Throw errors on invalid property type.
* @throws \DomainException Throw errors when `move_uploaded_to` property was not set.
*/
protected function validateOptionsProperties()
{
Expand Down Expand Up @@ -1356,7 +1358,7 @@ protected function validateOptionsProperties()
}

if (empty($this->move_uploaded_to)) {
trigger_error('The move_uploaded_to property was not set', E_USER_ERROR);
throw new \DomainException('The move_uploaded_to property was not set', 1);
}

if (!is_string($this->new_file_name) && $this->new_file_name != null) {
Expand Down
37 changes: 18 additions & 19 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./tests/phpunit/phpunit.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"
backupGlobals="false"
backupStaticProperties="false"
bootstrap="./tests/phpunit/phpunit.php"
cacheDirectory=".phpunit.cache"
colors="true"
processIsolation="false"
stopOnFailure="false"
>
<testsuites>
<testsuite name="tests/phpunit">
<directory suffix=".php" phpVersion="7.0" phpVersionOperator="&lt;">./tests/phpunit/PHPB70</directory>
<directory suffix=".php" phpVersion="7.0.33" phpVersionOperator="==">./tests/phpunit/PHP70</directory>
<directory suffix=".php" phpVersion="7.1.33" phpVersionOperator="==">./tests/phpunit/PHP70</directory>
<directory suffix=".php" phpVersion="7.2" phpVersionOperator=">=">./tests/phpunit/PHP72</directory>
</testsuite>
</testsuites>
</phpunit>
<php>
<ini name="memory_limit" value="512M"/>
</php>
<testsuites>
<testsuite name="tests/phpunit">
<directory suffix="Test.php">./tests/phpunit/PHP84</directory>
</testsuite>
</testsuites>
</phpunit>
130 changes: 0 additions & 130 deletions tests/phpunit/PHP70/ThrowErrorTest.php

This file was deleted.

Loading

0 comments on commit ccdf630

Please sign in to comment.