$o = new stdclass;
$o->prop = "value";
+try {
+ var_dump($a + $o);
+} catch (EngineException $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
+
$c = $a + $o;
var_dump($c);
echo "Done\n";
?>
--EXPECTF--
+Notice: Object of class stdClass could not be converted to int in %sadd_002.php on line %d
+
+Exception: Unsupported operand types
+
Notice: Object of class stdClass could not be converted to int in %s on line %d
Fatal error: Unsupported operand types in %s on line %d
$o = new stdclass;
$o->prop = "value";
+try {
+ var_dump($o + $a);
+} catch (EngineException $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
+
$c = $o + $a;
var_dump($c);
echo "Done\n";
?>
--EXPECTF--
+Notice: Object of class stdClass could not be converted to int in %sadd_003.php on line %d
+
+Exception: Unsupported operand types
+
Notice: Object of class stdClass could not be converted to int in %s on line %d
Fatal error: Unsupported operand types in %s on line %d
$a = array(1,2,3);
+try {
+ var_dump($a + 5);
+} catch (EngineException $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
+
$c = $a + 5;
var_dump($c);
echo "Done\n";
?>
--EXPECTF--
+Exception: Unsupported operand types
+
Fatal error: Unsupported operand types in %s on line %d
$s1 = "some string";
+try {
+ var_dump($a + $s1);
+} catch (EngineException $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
+
$c = $a + $s1;
var_dump($c);
echo "Done\n";
?>
--EXPECTF--
+Exception: Unsupported operand types
+
Fatal error: Unsupported operand types in %s on line %d
--- /dev/null
+<?php
+const T = array(1,2) - array(0);
--- /dev/null
+--TEST--
+Constant Expressions with unsupported operands 001
+--FILE--
+<?php
+const T = array(1,2) - array(0);
+--EXPECTF--
+Fatal error: Unsupported operand types in %sconstant_expressions_exceptions_001.php on line 2
--- /dev/null
+--TEST--
+Constant Expressions with unsupported operands 002
+--FILE--
+<?php
+try {
+ require("constant_expressions_exceptions.inc");
+} catch (EngineException $e) {
+ echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
+}
+?>
+DONE
+--EXPECTF--
+Fatal error: Unsupported operand types in %sconstant_expressions_exceptions.inc on line 2
$a = array(1,2,3);
$b = array(1);
+try {
+ var_dump($a / $b);
+} catch (EngineException $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
+
$c = $a / $b;
var_dump($c);
echo "Done\n";
?>
--EXPECTF--
+Exception: Unsupported operand types
+
Fatal error: Unsupported operand types in %s on line %d
$a = array(1,2,3);
$b = array(1);
+try {
+ var_dump($a * $b);
+} catch (EngineException $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
+
$c = $a * $b;
var_dump($c);
echo "Done\n";
?>
--EXPECTF--
+Exception: Unsupported operand types
+
Fatal error: Unsupported operand types in %s on line %d
$a = array(1,2,3);
$b = array(1,2);
+try {
+ var_dump(~$b);
+} catch (EngineException $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
+
$a = ~$b;
var_dump($a);
echo "Done\n";
?>
--EXPECTF--
+Exception: Unsupported operand types
+
Fatal error: Unsupported operand types in %s on line %d
$a = array(1,2,3);
$b = array(1);
+try {
+ var_dump($a - $b);
+} catch (EngineException $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
+
$c = $a - $b;
var_dump($c);
echo "Done\n";
?>
--EXPECTF--
+Exception: Unsupported operand types
+
Fatal error: Unsupported operand types in %s on line %d
zend_array *symbol_table;
if (type & E_EXCEPTION) {
- char *message = NULL;
+ type &= ~E_EXCEPTION;
+ //TODO: we can't convert compile-time errors to exceptions yet???
+ if (EG(current_execute_data) && !CG(in_compilation)) {
+ char *message = NULL;
#if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
- va_start(args, format);
+ va_start(args, format);
#endif
- zend_vspprintf(&message, 0, format, args);
- zend_throw_exception(zend_get_engine_exception(), message, type & ~E_EXCEPTION);
- efree(message);
+ zend_vspprintf(&message, 0, format, args);
+ zend_throw_exception(zend_get_engine_exception(), message, type);
+ efree(message);
#if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
- va_end(args);
+ va_end(args);
#endif
- return;
+ return;
+ }
}
/* Report about uncaught exception in case of fatal errors */
zendi_convert_scalar_to_number(op2, op2_copy, result);
converted = 1;
} else {
- zend_error(E_ERROR, "Unsupported operand types");
+ zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
return FAILURE; /* unknown datatype */
}
}
zendi_convert_scalar_to_number(op2, op2_copy, result);
converted = 1;
} else {
- zend_error(E_ERROR, "Unsupported operand types");
+ zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
return FAILURE; /* unknown datatype */
}
}
zendi_convert_scalar_to_number(op2, op2_copy, result);
converted = 1;
} else {
- zend_error(E_ERROR, "Unsupported operand types");
+ zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
return FAILURE; /* unknown datatype */
}
}
}
converted = 1;
} else {
- zend_error(E_ERROR, "Unsupported operand types");
+ zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
return FAILURE;
}
}
zendi_convert_scalar_to_number(op2, op2_copy, result);
converted = 1;
} else {
- zend_error(E_ERROR, "Unsupported operand types");
+ zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
return FAILURE; /* unknown datatype */
}
}
default:
ZEND_TRY_UNARY_OBJECT_OPERATION(ZEND_BW_NOT);
- zend_error(E_ERROR, "Unsupported operand types");
+ zend_error(E_EXCEPTION | E_ERROR, "Unsupported operand types");
return FAILURE;
}
}