Skip to content

Compatibility with PHP 8.6.0beta1 - #18

Open
remicollet wants to merge 3 commits into
php:masterfrom
remicollet:issue-8.6.0beta1
Open

Compatibility with PHP 8.6.0beta1#18
remicollet wants to merge 3 commits into
php:masterfrom
remicollet:issue-8.6.0beta1

Conversation

@remicollet

Copy link
Copy Markdown
Member

Tested with PHP 7.0 and 8.6.0beta1

  . ZEND_LTOA() (and ZEND_LTOA_BUF_LEN) has been removed, as it was
    unsafe. Directly use ZEND_LONG_FMT with a function from the
    printf family.
  . The zval_dtor() alias of zval_ptr_dtor_nogc() has been removed.
    Call zval_ptr_dtor_nogc() directly instead.
  . The XtOffsetOf() alias of C’s offsetof() macro has been removed. Use
    offsetof() directly.
@somethingwithproof

Copy link
Copy Markdown
Contributor

(zend_ulong) truncates where time_t is 64-bit but zend_long is 32-bit, since ZEND_ULONG_FMT is PRIu32 there. A 13-digit timestamp on i386 with -D_TIME_BITS=64:

sizeof(time_t)=8 sizeof(long)=4
  ZEND_ULONG_FMT + (zend_ulong) -> 3487918180
  PRId64 + (int64_t)            -> 1700000000100

"%" PRId64 with (int64_t) keeps it exact and the buffer can drop to 24. Same three macros in #14 with that spelling, plus an allowed-to-fail 8.6 job so it does not drift again — happy to close mine if you would rather carry this one.

@remicollet

Copy link
Copy Markdown
Member Author

@somethingwithproof this PR is strictly to fix build with 8.6 (minimal)
The same cast issue exists in previous code (as lot of other issues)

I won't have much time before next week to look at this

BTW, who still cares about 32-bit ? :p ;)

@somethingwithproof

Copy link
Copy Markdown
Contributor

No worries, I was just pushing up my local work. I agree with you about 32 bit but you know there's somebody out there I guess.

@somethingwithproof

somethingwithproof commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Keeping #18 to the minimal PHP 8.6 build fix makes sense. I will let this land first, then rebase my stack and remove the overlap from #14. The wider timestamp handling in #12 will remain separate: it addresses the existing buffer overflow and the fetch-loop width issue, with regression coverage, rather than being required for the 8.6 build. No rush on reviewing the rest before next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants