com php-src: Test strict code including weak code and vice-versa: Zend/tests/typehints/explicit_weak_include_strict.phpt
Zend/tests/typehints/strict_include_explicit_weak.ph pt Zend/tests/typehints/strict_include_explicit_weak_ 2.inc
Zend/tests/typehints/strict_include_weak.phpt Zend/tests/typehints/strict_include_weak_2.inc Z end/tests/typehints/weak_include_strict.phpt
Zend/tests /typehints/weak_include_strict_2.inc

From: Date: Tue, 10 Feb 2015 15:48:07 +0000
Subject: com php-src: Test strict code including weak code and vice-versa: Zend/tests/typehints/explicit_weak_include_strict.phpt
Zend/tests/typehints/strict_include_explicit_weak.ph pt Zend/tests/typehints/strict_include_explicit_weak_ 2.inc
Zend/tests/typehints/strict_include_weak.phpt Zend/tests/typehints/strict_include_weak_2.inc Z end/tests/typehints/weak_include_strict.phpt
Zend/tests /typehints/weak_include_strict_2.inc
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-85720@lists.php.net to get a copy of this message
Commit: 17b3707bad9b896a79c2b56ece433faab348b587 Author: Andrea Faulds <ajf@ajf.me> Sun, 25 Jan 2015 02:41:53 +0000 Parents: 86b0685f55fe72590296acae056f996bc951a461 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=17b3707bad9b896a79c2b56ece433faab348b587 Log: Test strict code including weak code and vice-versa Changed paths: A Zend/tests/typehints/explicit_weak_include_strict.phpt A Zend/tests/typehints/strict_include_explicit_weak.phpt A Zend/tests/typehints/strict_include_explicit_weak_2.inc A Zend/tests/typehints/strict_include_weak.phpt A Zend/tests/typehints/strict_include_weak_2.inc A Zend/tests/typehints/weak_include_strict.phpt A Zend/tests/typehints/weak_include_strict_2.inc Diff: diff --git a/Zend/tests/typehints/explicit_weak_include_strict.phpt b/Zend/tests/typehints/explicit_weak_include_strict.phpt new file mode 100644 index 0000000..b7bcc5d --- /dev/null +++ b/Zend/tests/typehints/explicit_weak_include_strict.phpt @@ -0,0 +1,14 @@ +--TEST-- +explicitly strict_types=0 code including strict_types=1 code +--FILE-- +<?php + +declare(strict_types=0); + +// file with strict_types=1 +require 'weak_include_strict_2.inc'; + +// calls within that file should stay strict, despite being included by weak file +?> +--EXPECTF-- +Catchable fatal error: Argument 1 passed to takes_int() must be of the type integer, float given, called in %sweak_include_strict_2.inc on line 9 and defined in %sweak_include_strict_2.inc on line 5 diff --git a/Zend/tests/typehints/strict_include_explicit_weak.phpt b/Zend/tests/typehints/strict_include_explicit_weak.phpt new file mode 100644 index 0000000..a42d633 --- /dev/null +++ b/Zend/tests/typehints/strict_include_explicit_weak.phpt @@ -0,0 +1,14 @@ +--TEST-- +strict_types=1 code including explicitly strict_types=0 code +--FILE-- +<?php + +declare(strict_types=1); + +// file that's explicitly weak +require 'strict_include_explicit_weak_2.inc'; + +// calls within that file should stay weak, despite being included by strict fille +?> +--EXPECTF-- +Success! diff --git a/Zend/tests/typehints/strict_include_explicit_weak_2.inc b/Zend/tests/typehints/strict_include_explicit_weak_2.inc new file mode 100644 index 0000000..3da32e1 --- /dev/null +++ b/Zend/tests/typehints/strict_include_explicit_weak_2.inc @@ -0,0 +1,9 @@ +<?php + +declare(strict_types=0); + +function takes_int(int $x) { + echo "Success!"; +} + +takes_int(1.0); // succeeds in weak mode diff --git a/Zend/tests/typehints/strict_include_weak.phpt b/Zend/tests/typehints/strict_include_weak.phpt new file mode 100644 index 0000000..ce29db7 --- /dev/null +++ b/Zend/tests/typehints/strict_include_weak.phpt @@ -0,0 +1,14 @@ +--TEST-- +strict_types=1 code including strict_types=0 code +--FILE-- +<?php + +declare(strict_types=1); + +// file that's implicitly weak +require 'strict_include_weak_2.inc'; + +// calls within that file should stay weak, despite being included by strict file +?> +--EXPECTF-- +Success! diff --git a/Zend/tests/typehints/strict_include_weak_2.inc b/Zend/tests/typehints/strict_include_weak_2.inc new file mode 100644 index 0000000..d4ee8a8 --- /dev/null +++ b/Zend/tests/typehints/strict_include_weak_2.inc @@ -0,0 +1,9 @@ +<?php + +// implicitly weak code + +function takes_int(int $x) { + echo "Success!"; +} + +takes_int(1.0); // succeeds in weak mode diff --git a/Zend/tests/typehints/weak_include_strict.phpt b/Zend/tests/typehints/weak_include_strict.phpt new file mode 100644 index 0000000..371b26d --- /dev/null +++ b/Zend/tests/typehints/weak_include_strict.phpt @@ -0,0 +1,14 @@ +--TEST-- +strict_types=0 code including strict_types=1 code +--FILE-- +<?php + +// implicitly weak code + +// file with strict_types=1 +require 'weak_include_strict_2.inc'; + +// calls within that file should stay strict, despite being included by weak file +?> +--EXPECTF-- +Catchable fatal error: Argument 1 passed to takes_int() must be of the type integer, float given, called in %sweak_include_strict_2.inc on line 9 and defined in %sweak_include_strict_2.inc on line 5 diff --git a/Zend/tests/typehints/weak_include_strict_2.inc b/Zend/tests/typehints/weak_include_strict_2.inc new file mode 100644 index 0000000..8acfc03 --- /dev/null +++ b/Zend/tests/typehints/weak_include_strict_2.inc @@ -0,0 +1,9 @@ +<?php + +declare(strict_types=1); + +function takes_int(int $x) { + echo "Success!"; +} + +takes_int(1.0); // fails in strict mode

« previous php.cvs (#85720) next »