php_vm 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/php_vm/php_vm.c +16 -5
- metadata +2 -2
data/ext/php_vm/php_vm.c
CHANGED
@@ -314,14 +314,13 @@ int call_php_method(zend_class_entry *ce, zval *obj, zend_function *mptr, int ar
|
|
314
314
|
|
315
315
|
// Ruby
|
316
316
|
|
317
|
-
VALUE backtrace_re;
|
318
|
-
|
319
317
|
VALUE get_callee_name()
|
320
318
|
{
|
321
319
|
VALUE backtrace_arr = rb_funcall(rb_mKernel, rb_intern("caller"), 1, INT2NUM(0));
|
322
320
|
if (backtrace_arr!=Qnil) {
|
323
321
|
VALUE backtrace = rb_funcall(backtrace_arr, rb_intern("first"), 0);
|
324
322
|
if (backtrace!=Qnil) {
|
323
|
+
VALUE backtrace_re = rb_funcall(rb_cRegexp, rb_intern("new"), 1, rb_str_new2("^(.+?):(\\d+)(?::in `(.*)')?"));
|
325
324
|
VALUE m = rb_funcall(backtrace, rb_intern("match"), 1, backtrace_re);
|
326
325
|
if (m!=Qnil) {
|
327
326
|
return rb_funcall(m, rb_intern("[]"), 1, INT2NUM(3));
|
@@ -690,6 +689,19 @@ VALUE rb_php_global_echo(int argc, VALUE *argv, VALUE self)
|
|
690
689
|
return Qnil;
|
691
690
|
}
|
692
691
|
|
692
|
+
VALUE rb_php_global_array(int argc, VALUE *argv, VALUE self)
|
693
|
+
{
|
694
|
+
VALUE result;
|
695
|
+
if (argc==1 && TYPE(argv[0])==T_HASH) {
|
696
|
+
// hash
|
697
|
+
result = argv[0];
|
698
|
+
} else {
|
699
|
+
// argv
|
700
|
+
rb_scan_args(argc, argv, "*", &result);
|
701
|
+
}
|
702
|
+
return result;
|
703
|
+
}
|
704
|
+
|
693
705
|
|
694
706
|
// class PHPVM::PHPClass
|
695
707
|
|
@@ -875,8 +887,6 @@ void Init_php_vm()
|
|
875
887
|
php_vm_module_init();
|
876
888
|
atexit(php_vm_module_exit);
|
877
889
|
|
878
|
-
backtrace_re = rb_funcall(rb_cRegexp, rb_intern("new"), 1, rb_str_new2("^(.+?):(\\d+)(?::in `(.*)')?"));
|
879
|
-
|
880
890
|
// module PHPVM
|
881
891
|
rb_mPHPVM = rb_define_module("PHPVM");
|
882
892
|
|
@@ -886,11 +896,12 @@ void Init_php_vm()
|
|
886
896
|
rb_define_singleton_method(rb_mPHPVM, "get_class", rb_php_vm_get_class, 1);
|
887
897
|
rb_define_singleton_method(rb_mPHPVM, "define_global", rb_php_vm_define_global, 0);
|
888
898
|
|
889
|
-
rb_define_const(rb_mPHPVM, "VERSION", rb_str_new2("1.2.
|
899
|
+
rb_define_const(rb_mPHPVM, "VERSION", rb_str_new2("1.2.4"));
|
890
900
|
|
891
901
|
// module PHPVM::PHPGlobal
|
892
902
|
rb_mPHPGlobal = rb_define_module_under(rb_mPHPVM, "PHPGlobal");
|
893
903
|
rb_define_module_function(rb_mPHPGlobal, "echo", rb_php_global_echo, -1);
|
904
|
+
rb_define_module_function(rb_mPHPGlobal, "array", rb_php_global_array, -1);
|
894
905
|
rb_php_vm_define_global(rb_mPHPVM);
|
895
906
|
|
896
907
|
// class PHPVM::PHPClass
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: php_vm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: php_vm is a native bridge between Ruby and PHP.
|
15
15
|
email:
|