Skip to content

Possible deprecated error when logging is enabled, sending a card object  #458

@RickKukiela

Description

@RickKukiela

Regarding this line:

$prop->setValue($obj,preg_replace($inputPattern,$inputReplacement,$prop->getValue($obj)));

Previously, attempting to omit the cardCode value on "Stored Card" transaction (because the card code was not known / not obtained from the user), while SDK logging is enabled, would cause the referenced line to attempt to perform preg_replace() on a NULL value when parsing the card code value. (I guess in the above scenario, when $prop->getValue() returns NULL when the cardCode value was not set.)

Since passing NULL to the 3rd argument of preg_replace() is deprecated, it throws the error.

My fix was to simply cast the return value of $prop->getValue() as a string to ensure an empty string is passed instead of NULL.

Is this something that has been resolved elsewhere in the codebase and no longer needs to force the string? IE, is something changed were attempting to process a property that was not set, would now return an empty string rather than NULL?

Since this comes directly from a built-in reflection class, it seems, I don't think this is resolved in the current version.

To that end, I just published a PR that fixes this issue.
PR: #459

I'm OK using my fork, but it would be better for everyone if this gets merged to the main codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions