-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Coercive Types for Function Arguments #1125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…Andrea's proposal (https://wiki.php.net/rfc/scalar_type_hints) - type hints work according to standard "zend parsing patramers" rules (reusing code from ZPP) - Only lowercased scalar type names are allowed - 'bool', 'int', float', 'string' and 'resource'. It's still possible to create "class Int" and even use "Int" as a "class type hint". - Type checking functions are optimized for speed and size
* master: (65 commits) Add load time return type checking to match user land logic Add test function arguments fix data type mismatch fix unitialized val usage follow up fix for headers sent, checking a reference would be always true as well remove unused variable fix wars about importing of locally defined symbols fix data type Implemented internal function return types Updated NEWS Revert "Fixed bug #55407 (Impossible to prototype DateTime::createFromFormat)" Removed TSRMLS_D 5.6.7 now 5.5.23 now Simplify code and add comments Move zend_object->guards into additional slot of zend_object->properties_table[]. As result size of objects without __get/__set/__unset/__isset magic methods is reduced. Revert "json_decode() should generate a syntax error when given ""." Add note aout $HTTP_RAW_POST_DATA Use object pointers instead of handles make buildconf work as expected; autoconf really needs some help with all those external m4s ...
It's still possible to create classes with the same names, but they can't be used as type hints anymore.
* master: (84 commits) Fixed dump_bt and printzv Avoid repeatable calls to strstr() fix json globals Improve and generalize class constant substitution regenerated scanner fix datatype mismatches fix inconsistend dll linkage warn size_t vs int use size_t for str length generate missing json files from config.w32 Shut up, my lovely compiler; I do not like your warnings Márcio Almada remove dead tokens: T_CHARACTER, T_BAD_CHARACTER. fix detection of mbstate_t with clang Add missing NEWS and UPGRADING for bug #68938 moved the part of the test into an appropriate place Removed unused REGISTER_PDO_CONST_LONG Fix another invalid free of CG(interned_empty_string) add tests for #68996 Fixed #68790 (Missing return) Fixed #68790 (Missing return) ...
sapi/cli/php -r 'function hello(string $world) : string { var_dump(bin2hex($world)); return $world; } echo "foo" . hello(6) . "\n";'
* 'zpp_sth' of github.com:flaupretre/php-src: Fix typo Pre-configure ruleset according to STH RFC Implement NULL_TO_STRING and BOOL_TO_STRING restrictions Implement NULL_TO_FLOAT, BOOL_TO_FLOAT restrictions Implement NULL_TO_INT, BOOL_TO_INT Implement FLOAT_TO_INT restrictions Add xxx_TO_BOOL restrictions Add 'null' ZPP type Add STH configuration parameters Add sth_run.sh Add temporary config file Add zend_dval_is_integer()
* master: Improved ASSIGN_DIM handler Don't inline slow path Revert a part committted by mistake Fixed compilation warnings Fixed a bug that header value is not terminated by '\0' when accessed through getenv(). better name Improve fix for #69038 Update NEWs Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage)
* master: (225 commits) Improved ASSIGN_DIM handler Don't inline slow path Revert a part committted by mistake Fixed compilation warnings Fixed a bug that header value is not terminated by '\0' when accessed through getenv(). better name Improve fix for #69038 Update NEWs Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage) Added specialized versions of DO_FCALL handler: DO_ICALL - for internal functions DO_UCALL - for user functions DO_FCALL_BY_NAME - plain, most probably user, funcstions (not methods) Use cache_slot offsets instead of indexes (simplify run-time instructions) Split INIT_FCALL_BY_NAME inti INIT_FCALL_BY_NAME(CONST+STRING) and INIT_DYNAMIC_CALL(CONST-STRING|TMPVAR|CV) Support list($a, $b) = $a Avoid unnecassary check Make zend_array_destroy() to free the corresponding zend_array Eliminate check on the fast path Make current() and key() receive argument by value. Use Firebird default home folder, replace Interbase with Firebird Updated NEWS updated NEWS ...
* scalar_type_hints: Fixed use after free on the following code Make scalar type names case insensetive. It's still possible to create classes with the same names, but they can't be used as type hints anymore. Support for scalar return types of internal functions Implemented scalar type hints according to vatriation of version 0.1 Andrea's proposal (https://wiki.php.net/rfc/scalar_type_hints)
Emit E_STRICT only for internal functions when function expects scalar but NULL is passed Emit E_RECOVERABLE_ERROR for user functions
Can one of the admins verify this patch? |
* master: (253 commits) Fixed access on uninitialized data in Zend/tests/closure_019.phpt correct tests as the issue is only reproduceable with cgi/fpm Typo Fixed test added more exception tests fix leaking registry key handle don't pass zero to malloc() Update NEWS Fixed bug #66609 (php crashes with __get() and ++ operator in some cases) Errors converted to exceptions are not "recoverable" anymore. Fixed phar test segfault after merged engine exception Revert "Fixed phar file action failure after engine exception rfc been merged" Update NEWS/UPGRADING Deprecate "session_meta_capture" SSL context option Revert "Add stream_socket_crypto_info() function" Add crypto info to stream_get_meta_data() result on encrypted streams Fix is reverted (test fails in all branches) Fix crypto stream timeout regressions Fixed phar file action failure after engine exception rfc been merged Remove PHAR_GLOBALS (make it respect ZEND_ENABLE_STATIC_TSRMLS_CACHE) ... Conflicts: Zend/tests/return_types/rfc002.phpt Zend/zend_execute.c Zend/zend_vm_def.h Zend/zend_vm_execute.h
- allow string -> bool - allow leading spaces - allow trailing characters (will emit warning as in php5)
* master: Improve test script for #69212 Fix bug# 69215 (Crypto servers should send client CA list) Fixed memory leaks Free memory if destructor wasn't called Fixed memory leak More accurate reference counting on closures Fixed bug #69212 We don't cache custom strems with callbacks anymore Prevent possible double inheritance (ext/opcache/tests/bug67215.phpt) C89 compat
* master: Improved php_json_escape_string() Improved table search Comment out for now Fix memory leak Fixed memleak Fixed memory leak
Closing as RFC was rejected. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See https://wiki.php.net/rfc/coercive_sth