1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00
Commit Graph

1584 Commits

Author SHA1 Message Date
Dmitry Stogov
dddb40313b Keep track information about used JIT trigger in ZEND_FUNC_INFO(op_array)->func_info.flags 2020-09-29 13:05:24 +03:00
Nikita Popov
de77344de2 Promote pack/unpack format errors
Errors related to invalid format strings (unlike data mismatch
errors) should throw ValueError.

Closes GH-6185.
2020-09-22 15:12:05 +02:00
Nikita Popov
12d087c346 Use C zpp for get_class_vars() 2020-09-22 13:05:05 +02:00
Nikita Popov
fdd9018bdf Support uuencoding empty string
Cross checking implementations from other languages, empty strings
are always allowed. PHP's output is peculiar due to it's insistence
to encode a trailing \0, but otherwise sensible and does round-trip
as expected.
2020-09-22 12:39:39 +02:00
Nikita Popov
e60f927f05 stream_bucket_new() cannot return false
php_stream_bucket_new() is infallible.
2020-09-22 12:07:53 +02:00
Nikita Popov
9ef2c5c303 stream_get_transports/wrappers cannot return false
These may return an empty array, but not false.
2020-09-22 12:02:39 +02:00
Nikita Popov
aba0ee71b2 Don't return false for empty string in soundex()
Return "0000" instead of false to have a consistent return type.
"0000" is already a possible return value if the string doesn't
contain any letters, such as with soundex(" "). We can treat the
case of soundex("") exactly the same.
2020-09-22 11:44:35 +02:00
Nikita Popov
e547ea43c1 http_build_query() cannot fail
Assert that ht is not null and make php_url_encode_hash_ex() return
void to clarify that this is an infallible function.
2020-09-22 11:30:02 +02:00
Nikita Popov
ade57e691b substr_replace() cannot return false 2020-09-22 09:59:35 +02:00
Nikita Popov
8ff2f2f84b Return empty array for no rows in pg_fetch_all()
This makes it line up with pg_fetch_all_columns(), as well as
similar functions in other exts, such as mysqli_fetch_all().
2020-09-21 17:22:02 +02:00
Nikita Popov
54f03d31e0 Promote invalid field to ValueError in pgsql
The same error condition is a ValueError in mysqli, be consistent.

Additionally, do not display the argument name for these errors.
As the signatures are overloaded, the argument name may not match
the meaning at all.
2020-09-21 17:00:23 +02:00
Nikita Popov
d1bbc39e4c pg_unescape_bytea() can only fail on OOM
The implementation did not check for PQunescapeBytea failure
correctly, because it checked for a null pointer after estrndup,
which certainly cannot happen. Inspection of the PGunescapeBytea
implementation has shown that this function can only fail on OOM,
so let's check for that explicitly and remove false as a possible
return type.

While we're here, avoid an unnecessary copy of the result.
2020-09-21 15:46:55 +02:00
Sammy Kaye Powers
12306728c5 Add system ID entropy API
The `zend_system_id` is a (true global) system ID that fingerprints a process state. When extensions add engine hooks during MINIT/startup, entropy is added the system ID for each hook. This allows extensions to identify that changes have been made to the engine since the last PHP process restart.

Closes GH-5871
2020-09-18 14:26:44 -07:00
Nikita Popov
34bb5ba2ea Remove support for EXT_NOP
This is an annoying edge case that regularly gets broken. As we're
not aware of significant users of this API, and there are other
ways to hook this, remove support for EXT_NOP.
2020-09-18 11:03:08 +02:00
Dmitry Stogov
a9cbdafa69 Support for ZEND_COMPILE_EXTENDED_STMT 2020-09-17 23:19:28 +03:00
Nikita Popov
801cf66ab8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #80083
2020-09-17 10:14:19 +02:00
Nikita Popov
9c136f10cd Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #80083
2020-09-17 10:13:53 +02:00
Nikita Popov
a4f806aa79 Fixed bug #80083
Add db2_execute() to the list of functions accessing the local
scope. Ideally the API wouldn't do that, but it seems most
pragmatic to address this on the opcache side at this point.
2020-09-17 10:12:10 +02:00
Dmitry Stogov
f896b982cc Exclude trait methods from call-graph 2020-09-16 12:04:29 +03:00
George Peter Banyard
95f4ee38bb Add some ValueErrors to ext/date
Closes GH-5613
2020-09-16 01:29:28 +02:00
George Peter Banyard
7a95e943d6 Promote warnings to Error in MySQLi extension
Closes GH-5803
2020-09-15 19:12:02 +02:00
Máté Kocsis
c37a1cd650 Promote a few remaining errors in ext/standard
Closes GH-6110
2020-09-15 14:26:16 +02:00
George Peter Banyard
d0111d785d Promote warnings to Errors in PostgreSQL extension
Do some drive by indentation fixes
Also fix pg_select() in regards to the $result_type arg which was missing from ZPP

Closes GH-6129
2020-09-14 17:01:35 +02:00
Nikita Popov
8446e28275 Handle missing result_var in binary_op_result_type
For dim/obj compound ops we don't have a result_var. Not sure why
this never caused issues before, but this can crash with JIT.
2020-09-11 22:36:41 +02:00
Dmitry Stogov
d2efb7e6c4 Eliminate unnecessary IS_INDIRECT guards 2020-09-10 02:20:15 +03:00
Dmitry Stogov
1c59bd5caa Avoid more exception checks 2020-09-09 23:25:54 +03:00
Nikita Popov
3861cb87c2 More pgsql func info fixes 2020-09-09 21:49:13 +02:00
Máté Kocsis
8a5e3e40a9 Fix opcache return type info for pgsql functions 2020-09-09 21:43:44 +02:00
Dmitry Stogov
ee9948bc46 Eliminate unnecessary exception checks 2020-09-09 16:15:37 +03:00
Nikita Popov
8516434a56 Fixed bug #80046
We already protect against optimizing away loop frees in DFA pass,
but not in block pass.
2020-09-03 11:19:04 +02:00
Nikita Popov
ce74ff2b3d Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #80046
2020-09-03 11:18:11 +02:00
Nikita Popov
04e77d2dea Fixed bug #80046
We already protect against optimizing away loop frees in DFA pass,
but not in block pass.
2020-09-03 11:18:01 +02:00
Dmitry Stogov
bd8e0a96a5 Eliminate useless EG(exception) checks aftr FE_RESET/FE_FETCH 2020-09-01 18:56:47 +03:00
Nikita Popov
a99d08b5d1 Fix type inference for FE_RESET on invalid type
FE_RESET sets the result to UNDEF in this case. We should infer
some type here, because no type generally implies unreachable
code. In this case SCCP ended up replacing the FE_RESET result
with null, including in FE_FREE.
2020-09-01 13:59:36 +02:00
Nikita Popov
c088a9369f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix pi node removal when removing predecessor
2020-09-01 12:26:18 +02:00
Nikita Popov
37612936a1 Fix pi node removal when removing predecessor
We can't just remove the uses, we need to replace uses.

The test case only fails on master with SSA integrity violations,
but I believe the root issue also existed previously.
2020-09-01 12:25:00 +02:00
Nikita Popov
50975640bc Fixed bug #80030 2020-08-31 12:38:11 +02:00
George Peter Banyard
fa8d9b1183 Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics

Closes GH-6002
2020-08-28 15:41:27 +02:00
Dmitry Stogov
16b3b339ed Check reference guard once 2020-08-27 00:40:55 +03:00
Dmitry Stogov
d4383be6fa Use guard to check if array is packed or hash 2020-08-26 02:34:31 +03:00
Dmitry Stogov
e99954492e Avoid priniting "array [long, string] of" 2020-08-25 21:38:23 +03:00
Dmitry Stogov
2369f48092 Infer information about packed/hash arrays and use it for JIT 2020-08-25 18:28:23 +03:00
Dmitry Stogov
d384537859 Move AVOID_REFCOUNTING type info flag into a separate bit 2020-08-25 11:37:30 +03:00
Máté Kocsis
4c89ed61fb Promote warnings to exceptions in ext/gettext, ext/sysvmsg and ext/xml
Closes GH-5926
2020-08-03 20:09:28 +02:00
Nikita Popov
d92229d8c7 Implement named parameters
From an engine perspective, named parameters mainly add three
concepts:

 * The SEND_* opcodes now accept a CONST op2, which is the
   argument name. For now, it is looked up by linear scan and
   runtime cached.
 * This may leave UNDEF arguments on the stack. To avoid having
   to deal with them in other places, a CHECK_UNDEF_ARGS opcode
   is used to either replace them with defaults, or error.
 * For variadic functions, EX(extra_named_params) are collected
   and need to be freed based on ZEND_CALL_HAS_EXTRA_NAMED_PARAMS.

RFC: https://wiki.php.net/rfc/named_params

Closes GH-5357.
2020-07-31 15:53:36 +02:00
Nikita Popov
47e4001976 Remove more unused func_info fields 2020-07-30 18:50:12 +02:00
Nikita Popov
9dacc85251 Add type inference support for RECV_VARIADIC 2020-07-30 17:14:34 +02:00
Nikita Popov
104b7addc4 Remove unused recv_arg_info from func_info 2020-07-30 17:04:56 +02:00
Nikita Popov
ce22cf5198 Remove some dead code in RECV type inference
We must always have arg_info corresponding to RECV.
2020-07-30 16:55:21 +02:00
Nikita Popov
d8d2a7801a Merge branch 'PHP-7.4'
* PHP-7.4:
  Consider op1 literal of FETCH_OBJ_R
2020-07-29 17:05:42 +02:00