summaryrefslogtreecommitdiff
path: root/zend/value.cpp
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-05-06 09:33:22 +0200
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-05-06 09:33:22 +0200
commit927e54ecde25ed7ba718697631dc8ffd208e361a (patch)
tree97f8adc4f34be17af7fdc392b69bc94009123184 /zend/value.cpp
parent66e8672fc0902220e5a606438d208f7a8e52ddd5 (diff)
Value objects constructed with (const char *)NULL caused a crash, this has been fixed so they hold a PHP NULL value
Diffstat (limited to 'zend/value.cpp')
-rw-r--r--zend/value.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/zend/value.cpp b/zend/value.cpp
index 9040234..7fc45d6 100644
--- a/zend/value.cpp
+++ b/zend/value.cpp
@@ -124,9 +124,20 @@ Value::Value(const std::string &value)
*/
Value::Value(const char *value, int size)
{
- // create a string zval
+ // allocate the zval
MAKE_STD_ZVAL(_val);
- ZVAL_STRINGL(_val, value, size < 0 ? ::strlen(value) : size, 1);
+
+ // do we have a valid value?
+ if (value)
+ {
+ // create a string zval
+ ZVAL_STRINGL(_val, value, size < 0 ? ::strlen(value) : size, 1);
+ }
+ else
+ {
+ // store null
+ ZVAL_NULL(_val);
+ }
}
/**