Problem/Motivation

When need change color for pen or pad this error apear in create new node.

Drupal
10.2.4

Deprecated function: Invalid characters passed for attempted conversion, these have been ignored in _signature_field_color_unpack() (line 59 of modules/contrib/signature_field/signature_field.module).

If no custom color, no has any errors.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ady1503 created an issue. See original summary.

mukeshaddweb made their first commit to this issue’s fork.

mukeshaddweb’s picture

Status: Active » Needs review
gokulg’s picture

Status: Needs review » Reviewed & tested by the community

Tested MR !11 on Drupal 11.4.6 with PHP 8.4.24

Before patch:
- Invalid or partially valid color values were passed directly to _signature_field_color_unpack()
- This resulted in PHP deprecation warnings from hexdec() due to invalid characters

After applying the patch:
- Input is properly validated using regex (only #RGB / #RRGGBB allowed)
- Invalid values are rejected at form level
- _signature_field_color_unpack() safely returns NULL for invalid input
- Widget handles NULL values safely and avoids processing invalid data

Result:
- No deprecation warnings
- Input validation prevents incorrect values
- Code is now robust and consistent

RTBC.