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

Update Mpdf.php #1991

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open

Conversation

WilliamAlmeida
Copy link

Error:
The original code does not check if the variable $this->OTLtags['Plus'] is initialized before manipulating it. This can cause an error if the variable has not been defined previously, resulting in an attempt to manipulate a non-existent variable and potentially generating a runtime error.

Proposed Fix:
We added a check to ensure that the variable $this->OTLtags['Plus'] is initialized as an empty string before being used in the code. This is done with the following line of code added before the switch statement:

if (!isset($this->OTLtags['Plus'])) {
$this->OTLtags['Plus'] = '';
}

This fix prevents errors related to manipulating an undefined variable, ensuring that the code functions correctly regardless of the initial state of the $this->OTLtags['Plus'] variable.

Error:
The original code does not check if the variable `$this->OTLtags['Plus']` is initialized before manipulating it. This can cause an error if the variable has not been defined previously, resulting in an attempt to manipulate a non-existent variable and potentially generating a runtime error.

Proposed Fix:
We added a check to ensure that the variable `$this->OTLtags['Plus']` is initialized as an empty string before being used in the code. This is done with the following line of code added before the switch statement:

if (!isset($this->OTLtags['Plus'])) {
    $this->OTLtags['Plus'] = '';
}

This fix prevents errors related to manipulating an undefined variable, ensuring that the code functions correctly regardless of the initial state of the `$this->OTLtags['Plus']` variable.
@finwe
Copy link
Member

finwe commented Mar 3, 2024

Thanks for the PR, a unit test with example code demonstrating the reason for this fix is required, please update. Also, use shorter commit message (up to 80 characters) that is descriptive enough by itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants