summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/value.h8
-rw-r--r--zend/value.cpp8
2 files changed, 12 insertions, 4 deletions
diff --git a/include/value.h b/include/value.h
index 29b64af..97b1509 100644
--- a/include/value.h
+++ b/include/value.h
@@ -412,7 +412,9 @@ public:
char *reserve(size_t size);
/**
- * Get access to the raw buffer for read operations.
+ * Get access to the raw buffer for read operations. Note that this
+ * only works for string variables - other variables return nullptr.
+ *
* @return const char *
*/
const char *rawValue() const;
@@ -688,6 +690,10 @@ public:
/**
* Cast to byte array
+ *
+ * Note that this only works for string values, other
+ * variables return a nullptr.
+ *
* @return const char *
*/
operator const char * () const
diff --git a/zend/value.cpp b/zend/value.cpp
index 67bead3..d96ac57 100644
--- a/zend/value.cpp
+++ b/zend/value.cpp
@@ -1282,7 +1282,9 @@ char *Value::reserve(size_t size)
}
/**
- * Access to the raw buffer
+ * Get access to the raw buffer for read operations. Note that this
+ * only works for string variables - other variables return nullptr.
+ *
* @return const char *
*/
const char *Value::rawValue() const
@@ -1290,8 +1292,8 @@ const char *Value::rawValue() const
// must be a string
if (isString()) return Z_STRVAL_P(_val);
- // make a clone and return that buffer
- return clone(Type::String).rawValue();
+ // there is no raw value
+ return nullptr;
}
/**