longxinH / xhprof

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

Tests fail on PHP 8.2.0 beta3 and RC1 #68

Closed andypost closed 2 years ago

andypost commented 2 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error. rebuilding against PHP 8.2.0RC1 as API changed

  2. What did you expect to see? tests pass

  3. What did you see instead lots of failed tests

  4. What is your Xhprof version? 2.3.5

andypost commented 2 years ago
FAILED TEST SUMMARY
---------------------------------------------------------------------
XHProf: Basic Profiling Test
Author: Kannan [tests/xhprof_001.phpt]
XHProf: Test (direct and indirect) recursive function calls.
Author: Kannan [tests/xhprof_002.phpt]
XHProf: Test Class Methods, Constructors, Destructors.
Author: Kannan [tests/xhprof_003.phpt]
XHProf: Test Include File (load/run_init operations)
Author: Kannan [tests/xhprof_004.phpt]
XHProf: Test excluding call_user_func and similar functions
Author: mpal [tests/xhprof_007.phpt]
XHProf: Sampling Mode Test
Author: kannan [tests/xhprof_008.phpt]
andypost commented 2 years ago
TEST 1/13 [tests/xhprof_001.phpt]
========DIFF========
--
     foo==>bar                               : ct=       2; wt=*;
     main()                                  : ct=       1; wt=*;
     main()==>foo                            : ct=       1; wt=*;
006+ xhprof_disable==>xhprof_disable@1       : ct=       1; wt=*;

     Part 2: CPU
     foo==>bar                               : cpu=*; ct=       2; wt=*;
     main()                                  : cpu=*; ct=       1; wt=*;
     main()==>foo                            : cpu=*; ct=       1; wt=*;
013+ xhprof_disable==>xhprof_disable@1       : cpu=*; ct=       1; wt=*;

     Part 3: No Builtins
     foo==>bar                               : ct=       2; wt=*;
     main()                                  : ct=       1; wt=*;
019+ main()==>xhprof_disable                 : ct=       1; wt=*;

     Part 4: Memory
     foo==>bar                               : ct=       2; mu=*; pmu=*; wt=*;
     main()                                  : ct=       1; mu=*; pmu=*; wt=*;
     main()==>foo                            : ct=       1; mu=*; pmu=*; wt=*;
026+ xhprof_disable==>xhprof_disable@1       : ct=       1; mu=*; pmu=*; wt=*;

     Part 5: Memory & CPU
     foo==>bar                               : cpu=*; ct=       2; mu=*; pmu=*; wt=*;
     main()                                  : cpu=*; ct=       1; mu=*; pmu=*; wt=*;
     main()==>foo                            : cpu=*; ct=       1; mu=*; pmu=*; wt=*;
     main()==>xhprof_disable                 : cpu=*; ct=       1; mu=*; pmu=*; wt=*;
033+ xhprof_disable==>xhprof_disable@1       : cpu=*; ct=       1; mu=*; pmu=*; wt=*;
========DONE========

TEST 2/13 [tests/xhprof_002.phpt]
========DIFF========
--
     foo@3==>foo@4                           : ct=       1; wt=*;
     main()                                  : ct=       1; wt=*;
     main()==>foo                            : ct=       1; wt=*;
009+ xhprof_disable==>xhprof_disable@1       : ct=       1; wt=*;

     Indirect Recursion
     bar==>foo@1                             : ct=       1; wt=*;
--
     main()                                  : ct=       1; wt=*;
     main()==>foo                            : ct=       1; wt=*;
     main()==>xhprof_disable                 : ct=       1; wt=*;
023+ xhprof_disable==>xhprof_disable@1       : ct=       1; wt=*;
========DONE========

TEST 3/13 [tests/xhprof_003.phpt]
========DIFF========
--
     main()==>C::get_attr                    : ct=       1; wt=*;
     main()==>C::outer_static                : ct=       1; wt=*;
     main()==>xhprof_disable                 : ct=       1; wt=*;
012+ xhprof_disable==>xhprof_disable@1       : ct=       1; wt=*;
========DONE========

TEST 4/13 [tests/xhprof_004.phpt]
========DIFF========
--
     I am in foo()...
     11
     I am in bar()...
006+ explode==>explode@1                     : ct=       2; wt=*;
007+ implode==>implode@1                     : ct=       2; wt=*;
     main()                                  : ct=       1; wt=*;
     main()==>bar                            : ct=       1; wt=*;
     main()==>dirname                        : ct=       6; wt=*;
--
     main()==>load::%sxhprof_004_inc.php%w: ct=       1; wt=*;
     main()==>load::%sxhprof_004_require.php%w: ct=       1; wt=*;
     main()==>xhprof_disable                 : ct=       1; wt=*;
017+ xhprof_disable==>xhprof_disable@1       : ct=       1; wt=*;
========DONE========

TEST 7/13 [tests/xhprof_007.phpt]
========DIFF========
--
     main()                                  : ct=       1; wt=*;
     main()==>foo                            : ct=       1; wt=*;
     main()==>foo_array                      : ct=       1; wt=*;
011+ xhprof_disable==>xhprof_disable@1       : ct=       1; wt=*;

     Part 2a: Ignore call_user_func
     hello: user_func test
--
     main()                                  : ct=       1; wt=*;
     main()==>test_call_user_class::test_call_user_func: ct=       1; wt=*;
     main()==>xhprof_disable                 : ct=       1; wt=*;
021+ xhprof_disable==>xhprof_disable@1       : ct=       1; wt=*;

     Part 2b: Standard profile without parameters
     hello: user_func test
--
     main()                                  : ct=       1; wt=*;
     main()==>test_call_user_class::test_call_user_func: ct=       1; wt=*;
     main()==>xhprof_disable                 : ct=       1; wt=*;
031+ xhprof_disable==>xhprof_disable@1       : ct=       1; wt=*;

     Part 2c: Standard profile with empty array of ignored functions
     hello: user_func test
--
     main()                                  : ct=       1; wt=*;
     main()==>test_call_user_class::test_call_user_func: ct=       1; wt=*;
     main()==>xhprof_disable                 : ct=       1; wt=*;
041+ xhprof_disable==>xhprof_disable@1       : ct=       1; wt=*;

     Part 3: Ignore call_user_func_array
     hello: calling foo_array
--
     main()                                  : cpu=*; ct=       1; wt=*;
     main()==>test_call_user_func_array      : cpu=*; ct=       1; wt=*;
     main()==>xhprof_disable                 : cpu=*; ct=       1; wt=*;
051+ xhprof_disable==>xhprof_disable@1       : cpu=*; ct=       1; wt=*;

     Part 4: Ignore my_call_user_func_safe
     hello: Array
     Part 4 output:
057+ is_callable==>is_callable@1             : ct=       1; wt=*;
     main()                                  : ct=       1; wt=*;
     main()==>test_my_call_user_func_safe    : ct=       1; wt=*;
061+ test_my_call_user_func_safe@1==>foo     : ct=       1; wt=*;
062+ test_my_call_user_func_safe@1==>is_callable: ct=       1; wt=*;
     test_my_call_user_func_safe==>foo       : ct=       1; wt=*;
063+ xhprof_disable==>xhprof_disable         : ct=       1; wt=*;
055- test_my_call_user_func_safe==>foo       : ct=       1; wt=*;
056- test_my_call_user_func_safe==>is_callable: ct=       1; wt=*;

     Part 5a: Ignore my_call_user_func_array_safe and strlen
     hello: my_user_func_array_safetest
     Part 5a output:
069+ is_callable==>is_callable@1             : ct=       1; mu=*; pmu=*; wt=*;
     main()                                  : ct=       1; mu=*; pmu=*; wt=*;
     main()==>test_my_call_user_func_array_safe: ct=       1; mu=*; pmu=*; wt=*;
     main()==>xhprof_disable                 : ct=       1; mu=*; pmu=*; wt=*;
     test_my_call_user_func_array_safe==>foo_array: ct=       1; mu=*; pmu=*; wt=*;
075+ xhprof_disable==>xhprof_disable@1       : ct=       1; mu=*; pmu=*; wt=*;

     Part 5b: Profile call_user_func_array and my_call_user_func_array_safe
     hello: my_user_func_array_safetest
     Part 5b output:
081+ is_callable==>is_callable@1             : ct=       1; mu=*; pmu=*; wt=*;
     main()                                  : ct=       1; mu=*; pmu=*; wt=*;
     main()==>test_my_call_user_func_array_safe: ct=       1; mu=*; pmu=*; wt=*;
     main()==>xhprof_disable                 : ct=       1; mu=*; pmu=*; wt=*;
     my_call_user_func_array_safe==>foo_array: ct=       1; mu=*; pmu=*; wt=*;
     my_call_user_func_array_safe==>is_callable: ct=       1; mu=*; pmu=*; wt=*;
088+ xhprof_disable==>xhprof_disable@1       : ct=       1; mu=*; pmu=*; wt=*;

     Part 5c: Only ignore call_user_func_array
     hello: my_user_func_array_safetest
     Part 5c output:
094+ is_callable==>is_callable@1             : ct=       1; mu=*; pmu=*; wt=*;
     main()                                  : ct=       1; mu=*; pmu=*; wt=*;
     main()==>test_my_call_user_func_array_safe: ct=       1; mu=*; pmu=*; wt=*;
     main()==>xhprof_disable                 : ct=       1; mu=*; pmu=*; wt=*;
098+ test_my_call_user_func_array_safe@1==>foo_array: ct=       1; mu=*; pmu=*; wt=*;
099+ test_my_call_user_func_array_safe@1==>is_callable: ct=       1; mu=*; pmu=*; wt=*;
086- test_my_call_user_func_array_safe==>foo_array: ct=       1; mu=*; pmu=*; wt=*;
087- test_my_call_user_func_array_safe==>is_callable: ct=       1; mu=*; pmu=*; wt=*;
100+ xhprof_disable==>xhprof_disable@1       : ct=       1; mu=*; pmu=*; wt=*;
========DONE========

TEST 8/13 [tests/xhprof_008.phpt]
========DIFF========
001+ Test failed
001- Test passed
002+ Count of usleep samples in one call to goo(): 0
003+ Count of usleep samples in two calls to goo(): 0
004+ Samples in one call to goo(): 
005+ array(8) {
006+   ["1661934328.700000"]=>
007+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
008+   ["1661934328.800000"]=>
009+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
010+   ["1661934328.900000"]=>
011+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
012+   ["1661934329.000000"]=>
013+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
014+   ["1661934329.100000"]=>
015+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
016+   ["1661934329.200000"]=>
017+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
018+   ["1661934329.300000"]=>
019+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
020+   ["1661934329.400000"]=>
021+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
022+ }
023+ Samples in two calls to goo(): 
024+ array(16) {
025+   ["1661934329.500000"]=>
026+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
027+   ["1661934329.600000"]=>
028+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
029+   ["1661934329.700000"]=>
030+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
031+   ["1661934329.800000"]=>
032+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
033+   ["1661934329.900000"]=>
034+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
035+   ["1661934330.000000"]=>
036+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
037+   ["1661934330.100000"]=>
038+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
039+   ["1661934330.200000"]=>
040+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
041+   ["1661934330.300000"]=>
042+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
043+   ["1661934330.400000"]=>
044+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
045+   ["1661934330.500000"]=>
046+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
047+   ["1661934330.600000"]=>
048+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
049+   ["1661934330.700000"]=>
050+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
051+   ["1661934330.800000"]=>
052+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
053+   ["1661934330.900000"]=>
054+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
055+   ["1661934331.000000"]=>
056+   string(44) "main()==>goo==>bar==>foo==>usleep==>usleep@1"
057+ }
========DONE========
andypost commented 2 years ago

@longxinH probably because of https://github.com/php/php-src/commit/dc5475c1913c1e8c256c6d35b37e488b25055a37

longxinH commented 2 years ago

@andypost Thank you very much for the information, I am also looking for relevant information

andypost commented 2 years ago

@longxinH as I se https://github.com/php/php-src/commit/396b2aab85ebab0a72206e74ce87eda75a4167fd also may affect

andypost commented 2 years ago

Also I see following warnings caused by zend_compile_position position addition to zend_op_array

/home/skilld/aports/testing/php82-pecl-xhprof/src/xhprof-2.3.5/extension/xhprof.c: In function 'zm_startup_xhprof':
/home/skilld/aports/testing/php82-pecl-xhprof/src/xhprof-2.3.5/extension/xhprof.c:268:26: warning: assignment to 'zend_op_array * (*)(zend_string *, const char *)' {aka 'struct _zend_op_array * (*)(struct _zend_string *, const char *)'} from incompatible pointer type 'zend_op_array * (*)(zend_string *, const char *, zend_compile_position)' {aka 'struct _zend_op_array * (*)(struct _zend_string *, const char *, enum _zend_compile_position)'} [-Wincompatible-pointer-types]
  268 |     _zend_compile_string = zend_compile_string;
      |                          ^
/home/skilld/aports/testing/php82-pecl-xhprof/src/xhprof-2.3.5/extension/xhprof.c:269:25: warning: assignment to 'zend_op_array * (*)(zend_string *, const char *, zend_compile_position)' {aka 'struct _zend_op_array * (*)(struct _zend_string *, const char *, enum _zend_compile_position)'} from incompatible pointer type 'zend_op_array * (*)(zend_string *, const char *)' {aka 'struct _zend_op_array * (*)(struct _zend_string *, const char *)'} [-Wincompatible-pointer-types]
  269 |     zend_compile_string = hp_compile_string;
      |                         ^
/home/skilld/aports/testing/php82-pecl-xhprof/src/xhprof-2.3.5/extension/xhprof.c: In function 'zm_shutdown_xhprof':
/home/skilld/aports/testing/php82-pecl-xhprof/src/xhprof-2.3.5/extension/xhprof.c:308:27: warning: assignment to 'zend_op_array * (*)(zend_string *, const char *, zend_compile_position)' {aka 'struct _zend_op_array * (*)(struct _zend_string *, const char *, enum _zend_compile_position)'} from incompatible pointer type 'zend_op_array * (*)(zend_string *, const char *)' {aka 'struct _zend_op_array * (*)(struct _zend_string *, const char *)'} [-Wincompatible-pointer-types]
  308 |     zend_compile_string   = _zend_compile_string;
      |                           ^
longxinH commented 2 years ago

@andypost The latest master branch has resolved compatibility issues

andypost commented 2 years ago

@longxinH Thank you a lot! it works great! Please tag new release

longxinH commented 2 years ago

https://pecl.php.net/package/xhprof/2.3.6 https://github.com/longxinH/xhprof/releases/tag/v2.3.6

andypost commented 2 years ago

Thank you! pushed upgrade to Alpinelinux, php74 works too)