switch($type) {
case "int":
case "integer":
- if (!is_numeric($value)) $this->error("invalid value for integer constant: '$value'");
- if ((int)$value != $value) $this->error("invalid value for integer constant: '$value'");
- $this->constants[] = &new php_constant($name, (int)$value, "integer", trim($this->cdata));
+ $this->constants[] = &new php_constant($name, $value, "integer", trim($this->cdata));
break;
case "float":
$code .= "\tREGISTER_INI_ENTRIES();\n";
}
+ if(count($this->constants)) {
+ foreach($this->constants as $constant) {
+ $code .= $constant->c_code();
+ }
+ }
+
if(isset($this->internal_functions['MINIT'])) {
if(count($this->globals) || count($this->phpini)) $code .= "\n\t{\n";
$code .= $this->internal_functions['MINIT']->code;
foreach ($func->params as $key => $param) {
if (!empty($param['optional'])) $code.=" [";
if ($key) $code.=", ";
- $code .= $param['type']." ";
- $code .= isset($param['name']) ? $param['name'] : "par_$key";
+ $code .= $param['type'];
+ if($param['type'] != "void") {
+ $code .= isset($param['name']) ? $param['name'] : "par_$key";
+ }
}
}
for ($n=$func->optional; $n>0; $n--) {
$code .= "PHP_FUNCTION({$func->name})\n";
$code .= "{\n";
- $code .= "\tint argc = ZEND_NUM_ARGS();\n\n";
if (isset($func->params)) {
$arg_string="";
break;
}
}
+ }
+ if(strlen($arg_string)) {
+ $code .= "\tint argc = ZEND_NUM_ARGS();\n\n";
$code .= "\n\tif (zend_parse_parameters(argc TSRMLS_CC, \"$arg_string\", ".join(", ",$arg_pointers).") == FAILURE) return;\n";
if($res_fetch) $code.="\n$res_fetch\n";
} else {
- $code .= "\tif(argc>0) { WRONG_PARAM_COUNT; }\n";
+ $code .= "\tif(ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; }\n";
}
$code .= "\n";