RE: [PHP-DEV] C++ and FAST_ZPP macros
| From: | Anatol Belski | Date: | Tue, 19 Dec 2017 20:29:38 +0000 |
| Subject: | RE: [PHP-DEV] C++ and FAST_ZPP macros | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101391@lists.php.net to get a copy of this message | ||
Hi Sara,
> -----Original Message-----
> From: php@golemon.com [mailto:php@golemon.com] On Behalf Of Sara
> Golemon
> Sent: Monday, December 18, 2017 8:44 PM
> To: PHP internals <internals@lists.php.net>
> Subject: [PHP-DEV] C++ and FAST_ZPP macros
>
> This blog post came across my twitter today and it's certainly legit.
>
> https://cismon.net/2017/12/18/Fast-ZPP-s-Incompatibility-with-CPP/
>
> I tossed together this quick and dirty fix (and tested it with a simple C++
> extension), but I wanted to get a read on what branch folks think it should be
> applied to.
> https://github.com/sgolemon/php-
> src/commit/469ddd26331dbd736ad13eaac7170ccc43d09c7f
>
> As the blog post notes, it's a simple matter to work around the bug in extension
> code (indeed, an extension can simply opt to not use FAST_ZPP). On the other
> hand, the fix is pretty basic, and existing functionality of the default expected
> type effectively being Z_EXPECTED_LONG (because both have a value of zero) is
> just a bit....
> weird.
>
> Thoughts? If I don't hear anything in a week, I'll just apply to 7.1 and merge up.
>
C++11 requires a validity scope for enums, thus this change is unavoidable. IMO your second
suggestion were safer in the spirit of BC - Z_EXPECTED_LONG instead of IS_UNDEF by default, and a
new in master. Just because a workaround is possible and otherwise the issue is not critical.
Regards
Anatol