Skip to content

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
Contributor

@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
Contributor

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
Contributor

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
Contributor

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
@stale stale bot removed the stale label Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants