0008-main-php_ini.c-build-empty-php_load_zend_extension_c.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From b7bbdfbcb0869b5c068143d4e27bab9eac4ae72b Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  3. Date: Mon, 26 Feb 2018 19:30:55 +0100
  4. Subject: [PATCH] main/php_ini.c: build empty php_load_zend_extension_cb() when
  5. !HAVE_LIBDL
  6. Commit 0782a7fc6314c8bd3cbfd57f12d0479bf9cc8dc7 ("Fixed bug #74866
  7. extension_dir = "./ext" now use current directory for base") modified
  8. the php_load_zend_extension_cb() function to use php_load_shlib(), and
  9. pass a handle to the newly introduced zend_load_extension_handle()
  10. function instead of passing the extension path to
  11. zend_load_extension().
  12. While doing so, it introduced a call to php_load_shlib() from code
  13. that is built even when HAVE_LIBDL is not defined. However,
  14. php_load_shlib() is not implemented when HAVE_LIBDL is not defined,
  15. for obvious reasons.
  16. It turns out that zend_load_extension_handle() anyway doesn't do
  17. anything when ZEND_EXTENSIONS_SUPPORT is defined to 0, and
  18. ZEND_EXTENSIONS_SUPPORT is not defined when HAVE_LIBDL is not defined
  19. (Zend/zend_portability.h).
  20. Fixes the following build failure when building on a system that
  21. doesn't have libdl:
  22. main/php_ini.o: In function `php_load_zend_extension_cb':
  23. php_ini.c:(.text+0x478): undefined reference to `php_load_shlib'
  24. php_ini.c:(.text+0x4b0): undefined reference to `php_load_shlib'
  25. collect2: error: ld returned 1 exit status
  26. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  27. Upstream-status: https://github.com/php/php-src/pull/3161
  28. ---
  29. main/php_ini.c | 4 ++++
  30. 1 file changed, 4 insertions(+)
  31. diff --git a/main/php_ini.c b/main/php_ini.c
  32. index ba58eb1180..fca263e5f0 100644
  33. --- a/main/php_ini.c
  34. +++ b/main/php_ini.c
  35. @@ -350,6 +350,7 @@ static void php_load_php_extension_cb(void *arg)
  36. /* {{{ php_load_zend_extension_cb
  37. */
  38. +#ifdef HAVE_LIBDL
  39. static void php_load_zend_extension_cb(void *arg)
  40. {
  41. char *filename = *((char **) arg);
  42. @@ -409,6 +410,9 @@ static void php_load_zend_extension_cb(void *arg)
  43. efree(libpath);
  44. }
  45. }
  46. +#else
  47. +static void php_load_zend_extension_cb(void *arg) { }
  48. +#endif
  49. /* }}} */
  50. /* {{{ php_init_config
  51. --
  52. 2.14.3