GeezerVison is showing github.com — Support php 8.1 igbinary session · Issue #349 · igbinary/igbinary
Support php 8.1 igbinary session #349DescriptionHi,
Since upgrading to php 8.1, I have a regression with memcache.
Having this config doesn't work anymore :
extension = igbinary.so
session.serialize_handler=igbinary
We get an error :
PHP Warning: session_start(): Cannot find session serialization handler "igbinary" - session startup failed in /var/www/[...]/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php on line 149
Uncaught PHP Exception RuntimeException: "Failed to start the session." at /var/www/[...]/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php line 150\n
PHP Warning: session_start(): Cannot find session serialization handler "igbinary" - session startup failed in /var/www/[...]/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php on line 149
Php config :
igbinary
igbinary support => enabled
igbinary version => 3.2.6
igbinary APCu serializer ABI => no
igbinary session support => no
igbinary.compact_strings => On => On
igbinary support => yes
memcached.serializer => igbinary => igbinary
It seems the ibinary sessioon support with php 8.1 is broken.
If someone may provide a patch, that would be nice :)
Best regards ActivityTysonAndre commented on Dec 3, 2021 The session extension needs to be statically compiled into php for igbinary to work.
If the session extension is compiled as a shared extension, then historically, igbinary startup would fail if the session extension was loaded after igbinary in the php.ini configs, or if the session extension wasn't loaded at all.
Other session serializers do the same thing.
Duplicate of #116
#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
/* {{{ Serializer encode function */
/**
* This provides a serializer encode function for PHP's session module (using igbinary),
* if igbinary was compiled with session support.
*
* Session support has to be statically compiled into php to use igbinary,
* due to the lack of a cross-platform way to register a session serializer/unserializer
* when the session module isn't available.
*/
PS_SERIALIZER_ENCODE_FUNC(igbinary)rapsys commented on Dec 4, 2021 I don't see the point why it should be disabled when build as shared, it's the distribution problem to load session module before igbinary.
As long as it's documented, I don't understand why you disable this feature...
In my configuration, session extension is loaded before igbinary :
Additional .ini files parsed =>
/etc/php.d/05_assertion.ini,
/etc/php.d/05_date.ini,
/etc/php.d/05_mail.ini,
/etc/php.d/05_pcre.ini,
/etc/php.d/10_bz2.ini,
/etc/php.d/12_ctype.ini,
/etc/php.d/13_curl.ini,
/etc/php.d/18_dom.ini,
/etc/php.d/21_openssl.ini,
/etc/php.d/21_zlib.ini,
/etc/php.d/22_ftp.ini,
/etc/php.d/23_gd.ini,
/etc/php.d/24_gettext.ini,
/etc/php.d/26_iconv.ini,
/etc/php.d/27_imap.ini,
/etc/php.d/27_intl.ini,
/etc/php.d/29_mbstring.ini,
/etc/php.d/32_fileinfo.ini,
/etc/php.d/33_mysqlnd.ini,
/etc/php.d/43_posix.ini,
/etc/php.d/47_session.ini,
/etc/php.d/55_imagick.ini,
/etc/php.d/57_sysvsem.ini,
/etc/php.d/58_sysvshm.ini,
/etc/php.d/59_tidy.ini,
/etc/php.d/60_tokenizer.ini,
/etc/php.d/63_xmlreader.ini,
/etc/php.d/64_xmlwriter.ini,
/etc/php.d/66_bcmath.ini,
/etc/php.d/70_pdo.ini,
/etc/php.d/73_pdo_mysql.ini,
/etc/php.d/78_uuid.ini,
/etc/php.d/81_filter.ini,
/etc/php.d/83_zip.ini,
/etc/php.d/84_phar.ini,
/etc/php.d/85_sodium.ini,
/etc/php.d/98_ffi.ini,
/etc/php.d/99_opcache.ini,
/etc/php.d/A50_igbinary.ini,
/etc/php.d/A50_msgpack.ini,
/etc/php.d/A91_memcached.ini
I added this patch to have igbinary session support even when built with shared :
Enable igbinary session support even if session is built as shared.
See https://github.com/igbinary/igbinary/issues/349
diff -urNp igbinary-3.2.6.orig/src/php7/igbinary.c igbinary-3.2.6/src/php7/igbinary.c
--- igbinary-3.2.6.orig/src/php7/igbinary.c 2021-12-04 01:14:08.505791085 +0100
+++ igbinary-3.2.6/src/php7/igbinary.c 2021-12-04 01:15:06.126255360 +0100
@@ -27,7 +27,7 @@
#include "Zend/zend_enum.h"
#endif
-#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
+#if HAVE_PHP_SESSION
# include "ext/session/php_session.h"
#endif
@@ -68,10 +68,10 @@
#include "zend_alloc.h"
#include "igbinary_zend_hash.h"
-#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
+#if HAVE_PHP_SESSION
/** Session serializer function prototypes. */
PS_SERIALIZER_FUNCS(igbinary);
-#endif /* HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) */
+#endif /* HAVE_PHP_SESSION */
#if defined(HAVE_APCU_SUPPORT)
/** Apc serializer function prototypes */
@@ -350,7 +350,7 @@ zend_function_entry igbinary_functions[]
/* {{{ igbinary dependencies */
static const zend_module_dep igbinary_module_deps[] = {
ZEND_MOD_REQUIRED("standard")
-#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
+#if HAVE_PHP_SESSION
ZEND_MOD_REQUIRED("session")
#endif
#if defined(HAVE_APCU_SUPPORT)
@@ -412,7 +412,7 @@ PHP_MINIT_FUNCTION(igbinary) {
(void)module_number;
ZEND_INIT_MODULE_GLOBALS(igbinary, php_igbinary_init_globals, NULL);
-#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
+#if HAVE_PHP_SESSION
php_session_register_serializer("igbinary",
PS_SERIALIZER_ENCODE_NAME(igbinary),
PS_SERIALIZER_DECODE_NAME(igbinary));
@@ -463,7 +463,7 @@ PHP_MINFO_FUNCTION(igbinary) {
#else
php_info_print_table_row(2, "igbinary APCu serializer ABI", "no");
#endif
-#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
+#if HAVE_PHP_SESSION
php_info_print_table_row(2, "igbinary session support", "yes");
#else
php_info_print_table_row(2, "igbinary session support", "no");
@@ -850,7 +850,7 @@ PHP_FUNCTION(igbinary_serialize) {
efree(string);
}
/* }}} */
-#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
+#if HAVE_PHP_SESSION
/* {{{ Serializer encode function */
/**
* This provides a serializer encode function for PHP's session module (using igbinary),
@@ -969,7 +969,7 @@ deinit:
return SUCCESS;
}
/* }}} */
-#endif /* HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) */
+#endif /* HAVE_PHP_SESSION */
#if defined(HAVE_APCU_SUPPORT)
/* {{{ apc_serialize function */
TysonAndre commented on Dec 4, 2021
I don't see the point why it should be disabled when build as shared, it's the distribution problem to load session module before igbinary.
it'd be a problem for people who don't use igbinary with the session module with the crashes it'd cause when users do something differently from the distribution or build php on their own. - there are many other use cases for igbinary (apcu, memcached, directly calling it)
Some recipes might not even be using /etc/php.d/ properly and leave it to users to choose which extensions to enable in php.ini
https://github.com/msgpack/msgpack-php/issues?q=is%3Aissue+session+is%3Aclosed is an example of this, and just the issues that were reported before giving up or finding the solutions through a search engine mokraemer commented on Dec 5, 2021 @TysonAndre I think you can savely remove testing for COMPILE_DL_SESSION - we removed this long ago and never had problems with sessions and igbinary. You can still raise an error if session is not present while you try to register igbinary for the session. But doing this on compile time is against the module concept of php.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|