summaryrefslogtreecommitdiff
path: root/src/idl_gen_php.cpp
diff options
context:
space:
mode:
authorShuhei Tanuma <chobieee@gmail.com>2015-12-17 11:35:31 +0900
committerShuhei Tanuma <chobieee@gmail.com>2015-12-17 11:35:31 +0900
commitc9198dbbb8422306cb2d3b05b232ee114317e3f6 (patch)
treedbe1f50b1afd1cfdb5159f6557f0ff3ac343dfe2 /src/idl_gen_php.cpp
parentb974e95ce45d1a8e0e2053a32c0569c3d9b41200 (diff)
downloadflatbuffers-c9198dbbb8422306cb2d3b05b232ee114317e3f6.tar.gz
flatbuffers-c9198dbbb8422306cb2d3b05b232ee114317e3f6.tar.bz2
flatbuffers-c9198dbbb8422306cb2d3b05b232ee114317e3f6.zip
(PHP) fixes getting indirect table, also fixes getInt method on 32bit machine.
Diffstat (limited to 'src/idl_gen_php.cpp')
-rw-r--r--src/idl_gen_php.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/idl_gen_php.cpp b/src/idl_gen_php.cpp
index 2aa7e222..2488b1d1 100644
--- a/src/idl_gen_php.cpp
+++ b/src/idl_gen_php.cpp
@@ -249,7 +249,13 @@ namespace php {
NumToString(field.value.offset) +
");\n";
code += Indent + Indent;
- code += "return $o != 0 ? $obj->init($o + $this->bb_pos, $this->bb) : ";
+ code += "return $o != 0 ? $obj->init(";
+ if (field.value.type.struct_def->fixed)
+ {
+ code += "$o + $this->bb_pos, $this->bb) : ";
+ } else {
+ code += "$this->__indirect($o + $this->bb_pos), $this->bb) : ";
+ }
code += GenDefaultValue(field.value) + ";\n";
code += Indent + "}\n\n";
}