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 AbstractGenerator.php #470

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

Conversation

hillsinfoodle
Copy link

stop null warnings/errors when null options are set, noticed these occuring in php8.1

stop null warnings/errors when null options are set, noticed these in php8.1
@hillsinfoodle
Copy link
Author

Hey guys, thanks for taking the time to review this, if you believe the errors are due to misuse of the library etc happy for some pushback, but suspect these are worthwhile warning silencers.

Copy link
Member

@alexpozzi alexpozzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

Comment on lines -549 to +553
$command .= ' ' . $key . ' ' . \escapeshellarg($option);
$command .= ' ' . $key . ' ' . \escapeshellarg($option ?? '');
} elseif (\in_array($key, ['image-dpi', 'image-quality'])) {
$command .= ' --' . $key . ' ' . (int) $option;
} else {
$command .= ' --' . $key . ' ' . \escapeshellarg($option);
$command .= ' --' . $key . ' ' . \escapeshellarg($option ?? '');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for this as we already check if an option is neither null or false at the beginning.

Comment on lines -539 to +543
$command .= ' --' . $key . ' ' . \escapeshellarg($k) . ' ' . \escapeshellarg($v);
$command .= ' --' . $key . ' ' . \escapeshellarg($k) . ' ' . \escapeshellarg($v ?? '');
}
} else {
foreach ($option as $v) {
$command .= ' --' . $key . ' ' . \escapeshellarg($v);
$command .= ' --' . $key . ' ' . \escapeshellarg($v ?? '');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to double check on the wkhtmltopdf options but, IMHO, we should simply skip invalid array entries.
I think we should skip options with key/value that are not valid strings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm saying to skip it as it's the current behavior for null/false options.

@stale
Copy link

stale bot commented Jun 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants