|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-07-15 08:05 UTC] gopalv82 at yahoo dot com
[2009-07-16 00:08 UTC] capps at solareclipse dot net
[2009-07-16 00:10 UTC] capps at solareclipse dot net
[2009-08-26 09:41 UTC] denis dot gasparin at edistar dot com
[2009-11-20 09:36 UTC] prgarcial at gmail dot com
[2009-12-04 15:02 UTC] joel at purerave dot com
[2009-12-09 14:10 UTC] samm at os2 dot kiev dot ua
[2010-02-11 14:18 UTC] sdiebler at qualys dot com
[2010-02-18 10:39 UTC] miroslav at ansta dot co dot uk
[2010-02-23 13:05 UTC] mgenereu at gmail dot com
[2010-02-23 13:13 UTC] rasmus@php.net
[2010-02-25 04:53 UTC] pgarcial at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 10:00:01 2025 UTC |
Description: ------------ Greetings, I am using a database-backed session handler. In 5.3, without APC enabled, the session handler's write function fires properly, and data is written to the database. When APC is enabled, at least one of the following situations is true: 1) Object destruction for the session handler occurs before session write, causing writes to fail 2) Object destruction for the database handler occurs before session write, causing writes to fail 3) Script shutdown occurs before calling session write *I am completely aware that PHP changed the order of destruction operations in the 5.x releases so that objects may end up being destroyed before sessions are written. I want to re-iterate that this problem occurs if and only if APC is enabled. The code operates normally and correctly when APC is disabled.* Notes: - PHP version is 5.3.0, though only RC4 is listed in the drop-down. The code works properly under 5.2 and 5.1, though I can not test with APC and those versions. - No other PECL packages are installed - My session handler is lengthy and application-specific, and contains proprietary code that I can not release due to NDA. - The DB object is Zend_Db. - The only changes to the stock 5.3 php.ini are setting the timezone, enabling short open tags, and turning off expose_php. - My configure line, because it's been asked for above: './configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-mime-magic=/usr/share/file/magic' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--without-sqlite' '--without-sqlite3' '--disable-phar' '--disable-fileinfo' '--disable-json' '--without-pspell' '--disable-wddx' '--without-curl' '--disable-posix' '--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem' As mentioned, I can't post my session object code due to NDA, but I'm sure that any object-based session handler copied from any tutorial on the matter will show similar behavior. The code works normally and correctly in PHP 5.1, 5.2, and 5.3, and only malfunctions under 5.3 with APC enabled. My normal workaround for the PHP-changed-object-destruct-order issue is to add a __destruct function to the database object that calls session_write_close, under the blind assumption that it's being destroyed first and it's time to perform a session save. Because I'm using third party code (Zend_Db), I can't do that easily. Another method to work around the madness, and one that works in this case is posted in the Reproduce Code form in this bug submission. **Again, I am entirely aware of PHP's destruct order fun. I am not reporting that PHP issue. The behavior I am seeing here only occurs when APC is switched on, so this is an APC issue.** This may end up just having to be a documentation issue. Reproduce code: --------------- register_shutdown_function( create_function('$db_object,$session_object', 'session_write_close();' ), $db_object, $session_object ); // While the database object and session object are passed in, they are not used. // With any luck, PHP notices this and holds off on their destruction until the shutdown function can run. // This seems to work in practice, but I don't know if that's the required voodoo.