longxinH / xhprof

PHP7/PHP8 support
http://pecl.php.net/package/xhprof
Apache License 2.0
1.04k stars 165 forks source link

Building for PHP 8.4 alpha1 #85

Closed andypost closed 1 week ago

andypost commented 2 weeks ago

Bug Report

  1. Building extension for Alpinelinux edge using fresh PHP 8.4 alpha1, probably effect of transition to pcre2

  2. What did you expect to see? the build passed

  3. What did you see instead

    /bin/sh /mnt/testing/php84-pecl-xhprof/src/xhprof-2.3.9/extension/libtool --tag=CC --mode=compile gcc -I. -I/mnt/testing/php84-pecl-xhprof/src/xhprof-2.3.9/extension -I/usr/include/php84 -I/usr/include/php84/main -I/usr/include/php84/TSRM -I/usr/include/php84/Zend -I/usr/include/php84/ext -I/usr/include/php84/ext/date/lib  -DHAVE_CONFIG_H  -Os -fstack-clash-protection -Wformat -Werror=format-security -fno-plt -D_GNU_SOURCE    -DZEND_COMPILE_DL_EXT=1 -c /mnt/testing/php84-pecl-xhprof/src/xhprof-2.3.9/extension/xhprof.c -o xhprof.lo  -MMD -MF xhprof.dep -MT xhprof.lo
    gcc -I. -I/mnt/testing/php84-pecl-xhprof/src/xhprof-2.3.9/extension -I/usr/include/php84 -I/usr/include/php84/main -I/usr/include/php84/TSRM -I/usr/include/php84/Zend -I/usr/include/php84/ext -I/usr/include/php84/ext/date/lib -DHAVE_CONFIG_H -Os -fstack-clash-protection -Wformat -Werror=format-security -fno-plt -D_GNU_SOURCE -DZEND_COMPILE_DL_EXT=1 -c /mnt/testing/php84-pecl-xhprof/src/xhprof-2.3.9/extension/xhprof.c -MMD -MF xhprof.dep -MT xhprof.lo  -fPIC -DPIC -o .libs/xhprof.o
    /mnt/testing/php84-pecl-xhprof/src/xhprof-2.3.9/extension/xhprof.c: In function 'hp_pcre_match':
    /mnt/testing/php84-pecl-xhprof/src/xhprof-2.3.9/extension/xhprof.c:1292:9: error: too many arguments to function 'php_pcre_match_impl'
    1292 |         php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */,
      |         ^~~~~~~~~~~~~~~~~~~
    In file included from /mnt/testing/php84-pecl-xhprof/src/xhprof-2.3.9/extension/xhprof.c:41:
    /usr/include/php84/ext/pcre/php_pcre.h:52:14: note: declared here
    52 | PHPAPI void  php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str, zval *return_value,
      |              ^~~~~~~~~~~~~~~~~~~
    make: *** [Makefile:203: xhprof.lo] Error 1
  4. What is your Xhprof version? 2.3.9 (latest)

andypost commented 2 weeks ago

fixed with patch

--- xhprof.c.1  2024-07-04 15:12:10.061490736 +0200
+++ xhprof.c    2024-07-04 15:19:07.105383656 +0200
@@ -1287,6 +1287,11 @@
 #if PHP_VERSION_ID < 70400
         php_pcre_match_impl(pce_regexp, (char*)str, len, &matches, &subparts /* subpats */,
                         0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
+#elif PHP_VERSION_ID >= 80400
+        zend_string *tmp = zend_string_init(str, len, 0);
+        php_pcre_match_impl(pce_regexp, (char*)str, len, &matches, &subparts /* subpats */,
+                            0/* global */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
+        zend_string_release(tmp);
 #else
         zend_string *tmp = zend_string_init(str, len, 0);
         php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */,
andypost commented 2 weeks ago

Related to https://github.com/php/php-src/pull/12923

 f. ext/pcre
   - php_pcre_match_impl() now no longer has a use_flags argument.
     When flags should be ignored, pass 0 to the flags argument.