File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -261,7 +261,9 @@ PHP_FUNCTION(shm_put_var)
261261 RETURN_THROWS ();
262262 }
263263
264- ZEND_ASSERT (shm_var .s != NULL );
264+ if (UNEXPECTED (shm_var .s == NULL )) {
265+ RETURN_THROWS ();
266+ }
265267
266268 /* insert serialized variable into shared memory */
267269 bool ret = php_put_shm_data (shm_list_ptr -> ptr , shm_key , shm_var .s );
Original file line number Diff line number Diff line change 1+ --TEST--
2+ __serialize() exception in shm_put_var()
3+ --EXTENSIONS--
4+ sysvshm
5+ --FILE--
6+ <?php
7+
8+ $ key = ftok (__FILE__ , 't ' );
9+ $ s = shm_attach ($ key , 1024 );
10+
11+ class Test {
12+ public function __serialize () {
13+ throw new Error ("no " );
14+ }
15+ }
16+
17+ try {
18+ shm_put_var ($ s , 1 , new Test );
19+ } catch (Error $ exception ) {
20+ echo $ exception ->getMessage () . "\n" ;
21+ }
22+
23+ shm_remove ($ s );
24+
25+ ?>
26+ --EXPECT--
27+ no
You can’t perform that action at this time.
0 commit comments