2015-05-01 09:43:24 +00:00
|
|
|
--TEST--
|
|
|
|
Test V8::registerExtension() : Register extension with errors
|
|
|
|
--SKIPIF--
|
2015-07-25 16:16:04 +00:00
|
|
|
<?php
|
|
|
|
require_once(dirname(__FILE__) . '/skipif.inc');
|
|
|
|
|
|
|
|
ob_start(NULL, 0, PHP_OUTPUT_HANDLER_CLEANABLE | PHP_OUTPUT_HANDLER_REMOVABLE);
|
|
|
|
phpinfo(INFO_MODULES);
|
|
|
|
$minfo = ob_get_contents();
|
|
|
|
ob_end_clean();
|
|
|
|
|
2016-01-06 13:26:55 +00:00
|
|
|
if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
|
|
|
// On Windows the "Fatal error" happens to appear before the error
|
|
|
|
// message output by V8 itself.
|
|
|
|
echo "skip Windows";
|
|
|
|
}
|
|
|
|
|
2015-07-25 16:16:04 +00:00
|
|
|
if(preg_match("/V8 Engine Linked Version => (.*)/", $minfo, $matches)) {
|
|
|
|
$version = explode('.', $matches[1]);
|
2017-01-22 13:18:26 +00:00
|
|
|
if($version[0] < 5 || ($version[0] == 5 && $version[1] < 7)) {
|
2015-07-25 16:16:04 +00:00
|
|
|
// old v8 version, has shorter error message and hence doesn't
|
|
|
|
// fit our EXCEPTF below
|
2017-01-22 13:18:26 +00:00
|
|
|
echo "SKIP too old V8 version";
|
2015-07-25 16:16:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2015-05-01 09:43:24 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$handlebarsJs = "var root = typeof global !== 'undefined' ? global : window, \$Handlebars = 'test';";
|
|
|
|
echo "-- registerExtension --\n";
|
|
|
|
V8Js::registerExtension('handlebars', $handlebarsJs, [], true);
|
|
|
|
echo "-- creating V8Js object --\n";
|
|
|
|
$v8 = new V8Js();
|
|
|
|
var_dump($v8);
|
|
|
|
?>
|
|
|
|
===EOF===
|
|
|
|
--EXPECTF--
|
|
|
|
-- registerExtension --
|
2017-09-25 11:45:19 +00:00
|
|
|
|
|
|
|
Deprecated: Function V8Js::registerExtension() is deprecated in %s%eextensions_error.php on line 5
|
2015-05-01 09:43:24 +00:00
|
|
|
-- creating V8Js object --
|
|
|
|
Error installing extension 'handlebars'.
|
|
|
|
|
2015-10-02 22:01:12 +00:00
|
|
|
Fatal error: Uncaught V8JsException: Failed to create V8 context. Check that registered extensions do not have errors. in %s%eextensions_error.php:7
|
|
|
|
Stack trace:
|
|
|
|
#0 %s%eextensions_error.php(7): V8Js->__construct()
|
|
|
|
#1 {main}
|
|
|
|
thrown in %s%eextensions_error.php on line 7
|