laminas-hydrator icon indicating copy to clipboard operation
laminas-hydrator copied to clipboard

Hydrate/extract changes value when there are consecutive underscores

Open kirkmadera opened this issue 9 months ago • 1 comments

Bug Report

Q A
Version(s) 4.15.0

Summary

Current behavior

Extract/hydrate should be symmetrical. Extracting, then hydrating any value should produce the original value. This fails when there are consecutive underscores.

How to reproduce

$namingStrategy = new UnderscoreNamingStrategy();
$value = 'usb_a__out_usb_a_out';
var_dump($namingStrategy->hydrate($value));
var_dump($namingStrategy->extract($namingStrategy->hydrate($value)));

string(15) "usbA_outUsbAOut" string(19) "usb_a_out_usb_a_out"

Expected behavior

I would expect the second output to equal the original string.

kirkmadera avatar May 06 '24 21:05 kirkmadera