Opened 8 years ago

Closed 22 months ago

#37 closed defect (fixed)

xcache_get SEGV using objects

Reported by: judas_iscariote Owned by: moo
Priority: major Milestone: 3.0.0
Component: cacher Version: 1.0.1
Keywords: xcache_set objects Cc: soporte@…
Application: PHP Version:
Other Exts: SAPI: Irrelevant
Probability: Blocked By:
Blocking:

Description

PHP 5.1.6 xcache_get SEGV with objects.

<?php
//php built in stdClass
xcache_set("foo" , new stdClass);
var_dump(xcache_get("foo"));

?>

well, I expect either and error if objects are not supported, or the actual stored object var_dump'ed but not a segv :)

Change History (5)

comment:1 Changed 8 years ago by mOo

not supported yet. will be done when i find a easy way.

comment:2 Changed 8 years ago by judas_iscariote

--- xcache.c    (revisión: 199)
+++ xcache.c    (copia de trabajo)
@@ -1645,6 +1645,10 @@
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &name, &value, &xce.ttl) == FAILURE) {
                return;
        }
+       if (Z_TYPE_P(value) == IS_OBJECT) {
+           php_error_docref(NULL TSRMLS_CC, E_ERROR,"Objects cannot be stored in the variable cache");
+           return;
+       }

        /* max ttl */
        if (xc_var_maxttl && (!xce.ttl || xce.ttl > xc_var_maxttl)) {

ATM, crash can be avoided with something ugly like this. :)

comment:3 Changed 8 years ago by moo

  • Milestone changed from 1.0.3 to 1.2
  • Status changed from new to assigned

comment:4 Changed 7 years ago by moo

  • Milestone changed from 1.2 to 1.3.0

it's better to not coredump in 1.3 and store it in 2.0

comment:5 Changed 22 months ago by moo

  • pending set to 0
  • Resolution set to fixed
  • SAPI set to Irrelevant
  • Status changed from assigned to closed

fixed in [971]

Note: See TracTickets for help on using tickets.