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

Fix: Obtain certificate info when "," contained inside Quotation marks. #108

Merged
merged 2 commits into from
Aug 1, 2023

Conversation

celli33
Copy link
Contributor

@celli33 celli33 commented Jul 27, 2023

When comma is found inside certificate data the function LSNepomuceno\LaravelA1PdfSign\Sign\ValidatePdfSignature::processDataToInfo throws an Undefined array key 1 because of:

$data = explode(', ', $data);

It can be removed by using preg_split like:

/** it allows to split  by "," except when "," inside of quoutes */
$data = preg_split('/\s*,\s*(?=(?:[^"]*"[^"]*")*[^"]*$)/', trim($data));

For example:

$data = "emailAddress = contacto.tecnico@example.com, street = "AV. HIDALGO 77, COL. GUERRERO", postalCode = 06300"

the function: explode(", ", $data) will return and array separated in [["street" => "AV. HIDALGO 77"], [" COL. GUERRERO"]].

When expected is: [["street" => "AV. HIDALGO 77, COL. GUERRERO"]]

This PR closes #101

@lsnepomuceno lsnepomuceno self-assigned this Aug 1, 2023
@lsnepomuceno lsnepomuceno added the enhancement New feature or request label Aug 1, 2023
@lsnepomuceno
Copy link
Owner

Hello @celli33 ,

This PR is of great help, thank you for the support.

A new version of the package will be released on August 4th with its fix.

Thanks in advance.

@lsnepomuceno lsnepomuceno merged commit eb2a894 into lsnepomuceno:main Aug 1, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate certificate exception
2 participants