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.

  • udhaya kumar committed 49855611 on 3.x
    Revert "Fix #3440554: Change color."
    
    This reverts merge request !11
udhaya kumar’s picture

Status: Reviewed & tested by the community » Active
udhaya kumar’s picture

Status: Active » Reviewed & tested by the community

  • udhaya kumar committed 49855611 on 3440554-change-color-derevert
    Revert "Fix #3440554: Change color."
    
    This reverts merge request !11

udhaya kumar’s picture

Version: 3.0.3 » 3.x-dev
gokulg’s picture

Assigned: Unassigned » gokulg
Status: Reviewed & tested by the community » Needs review

I see that the changes have been merged into the '3.x-dev' branch. I'm currently reviewing and testing the merged implementation and will update this issue with the QA results once validation is complete.

gokulg’s picture

Assigned: gokulg » Unassigned
Status: Needs review » Fixed

I tested the latest changes from the '3.x-dev' branch.

Testing environments:

  1. Drupal 10.2.4 with PHP 8.1.34
  2. Drupal 11.4.11 with PHP 8.4.24

Testing performed:

  1. Configured custom pen colors.
  2. Configured custom pad/background colors.
  3. Verified the signature field on the node creation form.
  4. Tested drawing and saving signatures.
  5. Verified that the signature functionality works as expected.
  6. No deprecation warning was observed during testing.

The functionality worked as expected in both Drupal 10.2.4 and Drupal 11.4.11 environments.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.