Skip to content

Conversation

@devnexen
Copy link
Member

@devnexen devnexen commented Jul 8, 2025

No description provided.

@devnexen
Copy link
Member Author

devnexen commented Jul 9, 2025

Before the change

struct _zend_mysqli_globals {
        zend_long                  num_links;            /*     0     8 */
        zend_long                  max_links;            /*     8     8 */
        zend_long                  num_active_persistent; /*    16     8 */
        zend_long                  num_inactive_persistent; /*    24     8 */
        zend_long                  max_persistent;       /*    32     8 */
        _Bool                      allow_persistent;     /*    40     1 */

        /* XXX 7 bytes hole, try to pack */

        zend_ulong                 default_port;         /*    48     8 */
        char *                     default_host;         /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        char *                     default_user;         /*    64     8 */
        char *                     default_pw;           /*    72     8 */
        char *                     default_socket;       /*    80     8 */
        _Bool                      allow_local_infile;   /*    88     1 */

        /* XXX 7 bytes hole, try to pack */

        char *                     local_infile_directory; /*    96     8 */
        zend_long                  error_no;             /*   104     8 */
        char *                     error_msg;            /*   112     8 */
        zend_long                  report_mode;          /*   120     8 */
        /* --- cacheline 2 boundary (128 bytes) --- */
        _Bool                      rollback_on_cached_plink; /*   128     1 */

        /* size: 136, cachelines: 3, members: 17 */
        /* sum members: 115, holes: 2, sum holes: 14 */
        /* padding: 7 */
        /* last cacheline: 8 bytes */
};

after

struct _zend_mysqli_globals {
        unsigned short             default_port;         /*     0     2 */
        _Bool                      allow_persistent;     /*     2     1 */
        _Bool                      allow_local_infile;   /*     3     1 */

        /* XXX 4 bytes hole, try to pack */

        char *                     default_host;         /*     8     8 */
        char *                     default_user;         /*    16     8 */
        char *                     default_pw;           /*    24     8 */
        char *                     default_socket;       /*    32     8 */
        char *                     local_infile_directory; /*    40     8 */
        char *                     error_msg;            /*    48     8 */
        zend_long                  num_links;            /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        zend_long                  max_links;            /*    64     8 */
        zend_long                  num_active_persistent; /*    72     8 */
        zend_long                  num_inactive_persistent; /*    80     8 */
        zend_long                  max_persistent;       /*    88     8 */
        zend_long                  error_no;             /*    96     8 */
        zend_long                  report_mode;          /*   104     8 */
        _Bool                      rollback_on_cached_plink; /*   112     1 */

        /* size: 120, cachelines: 2, members: 17 */
        /* sum members: 109, holes: 1, sum holes: 4 */
        /* padding: 7 */
        /* last cacheline: 56 bytes */
};

@devnexen devnexen marked this pull request as ready for review July 9, 2025 17:40
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting how this used zend_ini_parse_quantity_warn indirectly via OnUpdateLong. So you could've specified a port like "3K" and it would use port "3000". No idea if anyone relies on that but the current code makes sense.

@devnexen devnexen merged commit 39dda72 into php:master Oct 1, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants