Skip to content

Commit

Permalink
Php::Value constructor from _zend_string
Browse files Browse the repository at this point in the history
Previous commit exposes mishandling of _zend_string function arguments
by PHP-CPP to compiler. This commit fixes that problem.
  • Loading branch information
ebikt committed Apr 16, 2024
1 parent 5890384 commit 9950a0b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class PHPCPP_EXPORT Value : private HashParent
Value(char value);
Value(const std::string &value);
Value(const char *value, int size = -1);
Value(struct _zend_string *value);
Value(double value);
Value(const IniValue &value);

Expand Down
19 changes: 19 additions & 0 deletions zend/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,25 @@ Value::Value(const char *value, int size)
}
}

/**
* Constructor based on zend_string
* @param value
*/
Value::Value(struct _zend_string *value)
{
// is there a value?
if (value)
{
// create a string zval
ZVAL_STRINGL(_val, value->val, value->len);
}
else
{
// store null
ZVAL_NULL(_val);
}
}

/**
* Constructor based on decimal value
* @param value
Expand Down

0 comments on commit 9950a0b

Please sign in to comment.