@@ -143,11 +143,11 @@ static PHP_GINIT_FUNCTION(protobuf) { protobuf_globals->global_symtab = NULL; }
143143static PHP_RINIT_FUNCTION(protobuf) {
144144 // Create the global generated pool.
145145 // Reuse the symtab (if any) left to us by the last request.
146- upb_DefPool* symtab = PROTOBUF_G(global_symtab);
147- if (!symtab) {
148- PROTOBUF_G(global_symtab) = symtab = upb_DefPool_New();
149- zend_hash_init(&PROTOBUF_G(name_msg_cache), 64, NULL, NULL, 0 );
150- zend_hash_init(&PROTOBUF_G(name_enum_cache), 64, NULL, NULL, 0 );
146+ if (! PROTOBUF_G(global_symtab)) {
147+ zend_bool persistent = PROTOBUF_G(keep_descriptor_pool_after_request);
148+ PROTOBUF_G(global_symtab) = upb_DefPool_New();
149+ zend_hash_init(&PROTOBUF_G(name_msg_cache), 64, NULL, NULL, persistent );
150+ zend_hash_init(&PROTOBUF_G(name_enum_cache), 64, NULL, NULL, persistent );
151151 }
152152
153153 zend_hash_init(&PROTOBUF_G(object_cache), 64, NULL, NULL, 0);
@@ -308,7 +308,7 @@ zend_module_entry protobuf_module_entry = {
308308 protobuf_functions, // function list
309309 PHP_MINIT(protobuf), // process startup
310310 PHP_MSHUTDOWN(protobuf), // process shutdown
311- PHP_RINIT(protobuf), // request shutdown
311+ PHP_RINIT(protobuf), // request startup
312312 PHP_RSHUTDOWN(protobuf), // request shutdown
313313 NULL, // extension info
314314 PHP_PROTOBUF_VERSION, // extension version
0 commit comments