mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-09 16:28:41 +00:00
Passing integers that didn't fit in 32-bit integers from PHP to Javascript
did not work properly, now uses float to pass larger numbers.
This commit is contained in:
parent
0a85d27ee7
commit
9ddac3f124
@ -91,6 +91,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
|
|||||||
<file name="array_pass.phpt" role="test" />
|
<file name="array_pass.phpt" role="test" />
|
||||||
<file name="array_pass_flags.phpt" role="test" />
|
<file name="array_pass_flags.phpt" role="test" />
|
||||||
<file name="timezones.phpt" role="test" />
|
<file name="timezones.phpt" role="test" />
|
||||||
|
<file name="long.phpt" role="test" />
|
||||||
</dir>
|
</dir>
|
||||||
</dir>
|
</dir>
|
||||||
</contents>
|
</contents>
|
||||||
|
@ -28,6 +28,7 @@ extern "C" {
|
|||||||
#include "php_v8js_macros.h"
|
#include "php_v8js_macros.h"
|
||||||
#include <v8.h>
|
#include <v8.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
static void php_v8js_weak_object_callback(const v8::WeakCallbackData<v8::Object, zval> &data);
|
static void php_v8js_weak_object_callback(const v8::WeakCallbackData<v8::Object, zval> &data);
|
||||||
|
|
||||||
@ -852,6 +853,7 @@ static v8::Handle<v8::Value> php_v8js_hash_to_jsarr(zval *value, v8::Isolate *is
|
|||||||
v8::Handle<v8::Value> zval_to_v8js(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
v8::Handle<v8::Value> zval_to_v8js(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
v8::Handle<v8::Value> jsValue;
|
v8::Handle<v8::Value> jsValue;
|
||||||
|
long v;
|
||||||
|
|
||||||
switch (Z_TYPE_P(value))
|
switch (Z_TYPE_P(value))
|
||||||
{
|
{
|
||||||
@ -868,7 +870,12 @@ v8::Handle<v8::Value> zval_to_v8js(zval *value, v8::Isolate *isolate TSRMLS_DC)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IS_LONG:
|
case IS_LONG:
|
||||||
jsValue = V8JS_INT(Z_LVAL_P(value));
|
v = Z_LVAL_P(value);
|
||||||
|
if (v < - std::numeric_limits<int32_t>::min() || v > std::numeric_limits<int32_t>::max()) {
|
||||||
|
jsValue = V8JS_FLOAT((double)v);
|
||||||
|
} else {
|
||||||
|
jsValue = V8JS_INT(v);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IS_DOUBLE:
|
case IS_DOUBLE:
|
||||||
|
Loading…
Reference in New Issue
Block a user