2
1

0001-php8-compat.patch 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. From 7fde4dd4d26d2a4b7957a1010c6ea9e4b940fc62 Mon Sep 17 00:00:00 2001
  2. From: Stefan Saraev <stefan@saraev.ca>
  3. Date: Mon, 18 Jan 2021 23:22:52 +0200
  4. Subject: [PATCH] php8 compat
  5. Upstream: https://github.com/derickr/pecl-dbus/pull/8
  6. Signed-off-by: Herve Codina <herve.codina@bootlin.com>
  7. ---
  8. dbus.c | 55 ++++++++++++++++++++++++++++++------------------------
  9. php_dbus.h | 10 ++++++++++
  10. 2 files changed, 41 insertions(+), 24 deletions(-)
  11. diff --git a/dbus.c b/dbus.c
  12. index 9fde647..a98e2ea 100644
  13. --- a/dbus.c
  14. +++ b/dbus.c
  15. @@ -38,6 +38,9 @@
  16. #define Z_ADDREF_P(z) ((z)->refcount++)
  17. #endif
  18. +ZEND_BEGIN_ARG_INFO_EX(arginfo_void, 0, 0, 0)
  19. +ZEND_END_ARG_INFO()
  20. +
  21. /* {{{ arginfo */
  22. ZEND_BEGIN_ARG_INFO_EX(arginfo_dbus_object___call, 0, 0, 2)
  23. ZEND_ARG_INFO(0, function_name)
  24. @@ -46,44 +49,44 @@ ZEND_END_ARG_INFO()
  25. /* }}} */
  26. const zend_function_entry dbus_funcs_dbus[] = {
  27. - PHP_ME(Dbus, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  28. - PHP_ME(Dbus, addWatch, NULL, ZEND_ACC_PUBLIC)
  29. - PHP_ME(Dbus, waitLoop, NULL, ZEND_ACC_PUBLIC)
  30. - PHP_ME(Dbus, requestName, NULL, ZEND_ACC_PUBLIC)
  31. - PHP_ME(Dbus, registerObject, NULL, ZEND_ACC_PUBLIC)
  32. - PHP_ME(Dbus, createProxy, NULL, ZEND_ACC_PUBLIC)
  33. + PHP_ME(Dbus, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  34. + PHP_ME(Dbus, addWatch, arginfo_void, ZEND_ACC_PUBLIC)
  35. + PHP_ME(Dbus, waitLoop, arginfo_void, ZEND_ACC_PUBLIC)
  36. + PHP_ME(Dbus, requestName, arginfo_void, ZEND_ACC_PUBLIC)
  37. + PHP_ME(Dbus, registerObject, arginfo_void, ZEND_ACC_PUBLIC)
  38. + PHP_ME(Dbus, createProxy, arginfo_void, ZEND_ACC_PUBLIC)
  39. PHP_FE_END
  40. };
  41. const zend_function_entry dbus_funcs_dbus_object[] = {
  42. - PHP_ME(DbusObject, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PRIVATE)
  43. + PHP_ME(DbusObject, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PRIVATE)
  44. PHP_ME(DbusObject, __call, arginfo_dbus_object___call, ZEND_ACC_PUBLIC)
  45. PHP_FE_END
  46. };
  47. const zend_function_entry dbus_funcs_dbus_signal[] = {
  48. - PHP_ME(DbusSignal, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  49. - PHP_ME(DbusSignal, matches, NULL, ZEND_ACC_PUBLIC)
  50. - PHP_ME(DbusSignal, getData, NULL, ZEND_ACC_PUBLIC)
  51. - PHP_ME(DbusSignal, send, NULL, ZEND_ACC_PUBLIC)
  52. + PHP_ME(DbusSignal, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  53. + PHP_ME(DbusSignal, matches, arginfo_void, ZEND_ACC_PUBLIC)
  54. + PHP_ME(DbusSignal, getData, arginfo_void, ZEND_ACC_PUBLIC)
  55. + PHP_ME(DbusSignal, send, arginfo_void, ZEND_ACC_PUBLIC)
  56. PHP_FE_END
  57. };
  58. const zend_function_entry dbus_funcs_dbus_array[] = {
  59. - PHP_ME(DbusArray, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  60. - PHP_ME(DbusArray, getData, NULL, ZEND_ACC_PUBLIC)
  61. + PHP_ME(DbusArray, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  62. + PHP_ME(DbusArray, getData, arginfo_void, ZEND_ACC_PUBLIC)
  63. PHP_FE_END
  64. };
  65. const zend_function_entry dbus_funcs_dbus_dict[] = {
  66. - PHP_ME(DbusDict, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  67. - PHP_ME(DbusDict, getData, NULL, ZEND_ACC_PUBLIC)
  68. + PHP_ME(DbusDict, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  69. + PHP_ME(DbusDict, getData, arginfo_void, ZEND_ACC_PUBLIC)
  70. PHP_FE_END
  71. };
  72. #define PHP_DBUS_INT_WRAPPER_DEF(s,t) \
  73. const zend_function_entry dbus_funcs_dbus_##s[] = { \
  74. - PHP_ME(Dbus##t, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) \
  75. + PHP_ME(Dbus##t, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) \
  76. PHP_FE_END \
  77. };
  78. @@ -98,26 +101,26 @@ PHP_DBUS_INT_WRAPPER_DEF(uint64,UInt64);
  79. PHP_DBUS_INT_WRAPPER_DEF(double, Double);
  80. const zend_function_entry dbus_funcs_dbus_variant[] = {
  81. - PHP_ME(DbusVariant, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  82. - PHP_ME(DbusVariant, getData, NULL, ZEND_ACC_PUBLIC)
  83. + PHP_ME(DbusVariant, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  84. + PHP_ME(DbusVariant, getData, arginfo_void, ZEND_ACC_PUBLIC)
  85. PHP_FE_END
  86. };
  87. const zend_function_entry dbus_funcs_dbus_set[] = {
  88. - PHP_ME(DbusSet, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  89. - PHP_ME(DbusSet, getData, NULL, ZEND_ACC_PUBLIC)
  90. + PHP_ME(DbusSet, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  91. + PHP_ME(DbusSet, getData, arginfo_void, ZEND_ACC_PUBLIC)
  92. PHP_FE_END
  93. };
  94. const zend_function_entry dbus_funcs_dbus_struct[] = {
  95. - PHP_ME(DbusStruct, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  96. - PHP_ME(DbusStruct, getData, NULL, ZEND_ACC_PUBLIC)
  97. + PHP_ME(DbusStruct, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  98. + PHP_ME(DbusStruct, getData, arginfo_void, ZEND_ACC_PUBLIC)
  99. PHP_FE_END
  100. };
  101. const zend_function_entry dbus_funcs_dbus_object_path[] = {
  102. - PHP_ME(DbusObjectPath, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  103. - PHP_ME(DbusObjectPath, getData, NULL, ZEND_ACC_PUBLIC)
  104. + PHP_ME(DbusObjectPath, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
  105. + PHP_ME(DbusObjectPath, getData, arginfo_void, ZEND_ACC_PUBLIC)
  106. PHP_FE_END
  107. };
  108. @@ -405,7 +408,11 @@ static void dbus_register_classes(TSRMLS_D)
  109. dbus_ce_dbus = zend_register_internal_class_ex(&ce_dbus, NULL);
  110. memcpy(&dbus_object_handlers_dbus, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
  111. dbus_object_handlers_dbus.clone_obj = dbus_object_clone_dbus;
  112. +#if PHP_VERSION_ID < 80000
  113. dbus_object_handlers_dbus.compare_objects = dbus_object_compare_dbus;
  114. +#else
  115. + dbus_object_handlers_dbus.compare = dbus_object_compare_dbus;
  116. +#endif
  117. zend_declare_class_constant_long(dbus_ce_dbus, "BYTE", sizeof("BYTE")-1, DBUS_TYPE_BYTE TSRMLS_CC);
  118. zend_declare_class_constant_long(dbus_ce_dbus, "BOOLEAN", sizeof("BOOLEAN")-1, DBUS_TYPE_BOOLEAN TSRMLS_CC);
  119. diff --git a/php_dbus.h b/php_dbus.h
  120. index 8817544..1f0f551 100644
  121. --- a/php_dbus.h
  122. +++ b/php_dbus.h
  123. @@ -25,6 +25,16 @@
  124. #include "config.h"
  125. #endif
  126. +#if PHP_VERSION_ID >= 80000
  127. +#ifndef TSRMLS_D
  128. +#define TSRMLS_D void
  129. +#define TSRMLS_DC
  130. +#define TSRMLS_C
  131. +#define TSRMLS_CC
  132. +#define TSRMLS_FETCH()
  133. +#endif
  134. +#endif /* PHP_VERSION_ID >= 80000 */
  135. +
  136. #include "Zend/zend_hash.h"
  137. #define PHP_DBUS_VERSION "0.2.0"
  138. --
  139. 2.31.1