• Resolved dkrocket

    (@dkrocket)


    Hi,
    There’s a bug in WooCommerce database design which limits url to 256 characters in the wc_product_download_directories table.

    As per https://www.ietf.org/rfc/rfc1035.txt, a domain name can be 256 characters thus a URL such as https://{domain_name} will be more, at least 8 more characters.

    mysql> DESCRIBE wp_wc_product_download_directories
    -> ;
    ERROR 4031 (HY000): The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.
    No connection. Trying to reconnect…
    Connection id: 54109716
    Current database: rk6xrkn_teix

    +---------+-----------------+------+-----+---------+----------------+
    | Field | Type | Null | Key | Default | Extra |
    +---------+-----------------+------+-----+---------+----------------+
    | url_id | bigint unsigned | NO | PRI | NULL | auto_increment |
    | url | varchar(256) | NO | MUL | NULL | |
    | enabled | tinyint(1) | NO | | 0 | |
    +---------+-----------------+------+-----+---------+----------------+
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Jonayed (woo-hc)

    (@jonayedhosen)

    Hi @dkrocket ,

    You’re absolutely correct that the url column in the wp_wc_product_download_directories table is defined as varchar(256), which limits URLs to 256 characters. While this generally works for most use cases, there are scenarios—such as long URLs or domain names up to 255 characters (per RFC 1035)—where this limitation might cause issues.

    That said, this isn’t considered a bug. Instead, it’s a structural limitation of the database. If you frequently encounter URLs exceeding 256 characters, you can adjust the column type in your database from varchar(256) to something more accommodating, such as varchar(2048).

    If you believe this should be addressed as a bug or feel it warrants improvement as a feature, I’d encourage you to share your input with the WooCommerce team. You can submit a feature request or report an issue through these links:

    I hope this clears things up!

    Thread Starter dkrocket

    (@dkrocket)

    What an odd response!

    You’re saying that even though this 100% breaks the ability to insert rows when a domain name is 249 characters or longer that it is not a bug.

    I’ll go put in a PR for a migration to fix this but this is 100% a bug. I’m not sure how you can say it is not.

    Plugin Support Mahfuzur Rahman(woo-hc)

    (@mahfuzurwp)

    Hi @dkrocket,

    Thank you for sharing your perspective, and we completely understand where you’re coming from. You’re absolutely right that URLs exceeding 256 characters—especially with domain names nearing 249 characters—can lead to issues with the current database structure.

    To clarify, when we mentioned that this isn’t considered a bug, we were referring to the current implementation aligning with typical use cases and the design choices made at the time. However, we fully acknowledge that this limitation can disrupt certain scenarios, especially when handling longer domain names.

    Instead of classifying it as a bug, this can be considered a feature request to improve the database structure for greater flexibility. If you’d prefer, you can submit a feature request here: https://woocommerce.com/feature-requests/woocommerce/.

    We also appreciate your willingness to create a PR, as contributions like yours play a vital role in improving WooCommerce for everyone.

    Thanks again for highlighting this and helping to make WooCommerce better!

    Thread Starter dkrocket

    (@dkrocket)

    Thanks! I added a GitHub issue and will submit a PR. Guess I have to get used to the project terminology.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.