浏览代码

Merge remote-tracking branch 'stesie/remove-compat-exceptions' into php7

Stefan Siegl 7 年之前
父节点
当前提交
f1e2c36a0a
共有 5 个文件被更改,包括 1 次插入50 次删除
  1. 0 7
      README.md
  2. 0 1
      php_v8js_macros.h
  3. 0 33
      tests/issue_156_001.phpt
  4. 0 8
      v8js_main.cc
  5. 1 1
      v8js_object_export.cc

+ 0 - 7
README.md

@@ -414,10 +414,3 @@ objects obeying the above rules and re-thrown in JavaScript context.  If they
 are not caught by JavaScript code the execution stops and a
 `V8JsScriptException` is thrown, which has the original PHP exception accessible
 via `getPrevious` method.
-
-V8Js versions 0.2.4 and before did not stop JS code execution on PHP exceptions,
-but silently ignored them (even so succeeding PHP calls from within the same piece
-of JS code were not executed by the PHP engine).  This behaviour is considered as
-a bug and hence was fixed with 0.2.5 release.  Nevertheless there is a 
-compatibility php.ini switch (`v8js.compat_php_exceptions`) which turns previous
-behaviour back on.

+ 0 - 1
php_v8js_macros.h

@@ -113,7 +113,6 @@ ZEND_BEGIN_MODULE_GLOBALS(v8js)
   /* Ini globals */
   bool use_date; /* Generate JS Date objects instead of PHP DateTime */
   bool use_array_access; /* Convert ArrayAccess, Countable objects to array-like objects */
-  bool compat_php_exceptions; /* Don't stop JS execution on PHP exception */
 
   // Timer thread globals
   std::deque<v8js_timer_ctx *> timer_stack;

+ 0 - 33
tests/issue_156_001.phpt

@@ -1,33 +0,0 @@
---TEST--
-Test V8::executeString() : Backwards compatibility for issue #156
---SKIPIF--
-<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
---INI--
-v8js.compat_php_exceptions = 1
---FILE--
-<?php
-
-$v8 = new V8Js();
-
-$v8->throwPHPException = function () {
-    echo "throwing PHP exception now ...\n";
-    throw new \Exception('foo');
-};
-
-$JS = <<< EOT
-PHP.throwPHPException();
-print("... old behaviour was to not stop JS execution on PHP exceptions\\n");
-EOT;
-
-try {
-    $v8->executeString($JS, 'issue_156_001.js');
-} catch(Exception $e) {
-    var_dump($e->getMessage());
-}
-?>
-===EOF===
---EXPECT--
-throwing PHP exception now ...
-... old behaviour was to not stop JS execution on PHP exceptions
-string(3) "foo"
-===EOF===

+ 0 - 8
v8js_main.cc

@@ -112,19 +112,11 @@ static ZEND_INI_MH(v8js_OnUpdateUseArrayAccess) /* {{{ */
 }
 /* }}} */
 
-static ZEND_INI_MH(v8js_OnUpdateCompatExceptions) /* {{{ */
-{
-	V8JSG(compat_php_exceptions) = v8js_ini_to_bool(new_value);
-	return SUCCESS;
-}
-/* }}} */
-
 ZEND_INI_BEGIN() /* {{{ */
 	ZEND_INI_ENTRY("v8js.flags", NULL, ZEND_INI_ALL, v8js_OnUpdateV8Flags)
 	ZEND_INI_ENTRY("v8js.icudtl_dat_path", NULL, ZEND_INI_ALL, v8js_OnUpdateIcudatPath)
 	ZEND_INI_ENTRY("v8js.use_date", "0", ZEND_INI_ALL, v8js_OnUpdateUseDate)
 	ZEND_INI_ENTRY("v8js.use_array_access", "0", ZEND_INI_ALL, v8js_OnUpdateUseArrayAccess)
-	ZEND_INI_ENTRY("v8js.compat_php_exceptions", "0", ZEND_INI_ALL, v8js_OnUpdateCompatExceptions)
 ZEND_INI_END()
 /* }}} */
 

+ 1 - 1
v8js_object_export.cc

@@ -162,7 +162,7 @@ failure:
 		efree(fci.params);
 	}
 
-	if(EG(exception) && !V8JSG(compat_php_exceptions)) {
+	if(EG(exception)) {
 		if(ctx->flags & V8JS_FLAG_PROPAGATE_PHP_EXCEPTIONS) {
 			zval tmp_zv;
 			ZVAL_OBJ(&tmp_zv, EG(exception));