79432738

Date: 2025-02-12 10:40:27
Score: 1
Natty:
Report link

When setting the Product ID as an integer with leading zeros (e.g., 01, 02), the response.productDetails always returns an empty array when querying with IDs in string format such as '01', "01", '02', or "02". This issue occurs because numeric values with leading zeros are typically interpreted as standard integers (e.g., 01 and 1 are considered the same in many programming languages). However, when querying with a string representation of the ID, it does not match the stored integer value, resulting in no matching records being found. I also tested changing the Product ID to a string, such as "test", and queried it using 'test', which worked correctly. This suggests that the issue is specifically related to how the system handles numeric values with leading zeros. It is possible that when storing or processing IDs, the system automatically converts 01 and 02 to 1 and 2, causing a mismatch when querying with the original string representation ('01' or '02'). Meanwhile, non-numeric string values like "test" are handled correctly without conversion.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Starts with a question (0.5): When
  • Low reputation (1):
Posted by: Tiến Đinh