No notice is thrown for list() accesses, because we did not come
to an agreement regarding patterns like
while ([$key, $value] = yield $it->next()) { ... }
where silent null access may be desirable.
No effort is made to suppress multiple notices in access chains
likes $x[0][0][0], because the technical complexity this causes
does not seem worthwhile.
RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
Another stab in the dark to fix the intermittent failures of timeout
tests on macos CI: We're using ITIMER_PROF, which means that the
timer counts against user+system time. The "busy" wait loop counts
against real time. Currently it calls microtime() on every iteration.
If that call is implemented as a syscall rather than going through
vDSO or commpage we might be seeing many context switches here which
drive up the real time, but not user or system time.
See if making the loop busier and calling microtime() less helps the
situation.
RFC: https://wiki.php.net/rfc/tostring_exceptions
And convert some object to string conversion related recoverable
fatal errors into Error exceptions.
Improve exception safety of internal code performing string
conversions.
Ensure that the "creating default object from empty value" warning is
always thrown. Previously some cases were missing the warning, in
particular those going through FETCH_OBJ_W rather than a dedicated
opcode (like ASSIGN_OBJ).
One slightly unfortunate side-effect of this change is that something
like $a->b->c = 'd' will now generate two warnings rather than one
when $a is null (one for property b, one for property c).
I'm removing the argument entirely here, but we might want to change
this to passing null or and empty array instead, if the impact of
dropping it entirely turns out to be too large.
This was deprecated as part of https://wiki.php.net/rfc/deprecations_php_7_2
as a doc-only deprecation.
Access to undefined constants will now always result in an Error
exception being thrown.
This required quite a few test changes, because there were many
buggy tests that unintentionally used bareword fallback in combination
with error suppression.
RFC: https://wiki.php.net/rfc/typed_properties_v2
This is a squash of PR #3734, which is a squash of PR #3313.
Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.
According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.
C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."
Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.
According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.
C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."
Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.
According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.
C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."
Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.
According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.
C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."
Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.
According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.
C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."
Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.
According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.
C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."
Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
This patch simplifies line endings tracked in the Git repository and
syncs them to all include the LF style instead of the CRLF files.
Newline characters:
- LF (\n) (*nix and Mac)
- CRLF (\r\n) (Windows)
- CR (\r) (old Mac, obsolete)
To see which line endings are in the index and in the working copy the
following command can be used:
`git ls-files --eol`
Git additionally provides `.gitattributes` file to specify if some files
need to have specific line endings on all platforms (either CRLF or LF).
Changed files shouldn't cause issues on modern Windows platforms because
also Git can do output conversion is core.autocrlf=true is set on
Windows and use CRLF newlines in all files in the working tree.
Unless CRLF files are tracked specifically, Git by default tracks all
files in the index using LF newlines.
Instead overload get_properties_for for a few specific cases such
as array casts. This resolves the issue where ArrayObject
get_properties may violate engine invariants in some cases.
This seems to be a simple oversight, where we did not enable
exceptions. Other constexpr conditions already throw, so there is
no particular reason to stick to a fatal error here.
When including files in PHP tests a good practice so far has been to use
the *.inc extension. This patch renames few *.p5c files that are
included in phpt files.
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.
In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.
This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
In PHP static properties are shared between inheriting classes,
unless they are explicitly overwritten. However, because this
functionality was implemented using reference, it was possible
to break the implementation by reassigning the static property
reference.
This is fixed by switching the implementation from using references
to using INDIRECTs, which cannot be affected by userland code.
- Avoid iterators check/update on each HashTable update opration
- Keep position equal (or above) nNumUsed instead of HT_INVALID_IDX
- Fixed iterators handling in array_unshift()
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
run-tests.php enforces error_reporting=E_ALL (including E_STRICT),
setting this explicitly in not necessary. Conversely, after the
removal of some E_STRICT errors, explicitly excluding it is no
longer necessary in some places.
* Commands are not properly escaped for windows
* Specifying "-n" to check loaded modules causes "Module already loaded"
warning
* Extensions to be loaded need the "php_" prefix on Windows
Bug: https://bugs.php.net/bug.php?id=75042
Add back -n flag to fetch loaded extensions in run-tests.php
Add test for phpt EXTENSIONS directive
Add a second test for bug 75042
Add test to test loading of nonexistent shared module
with the EXTENSIONS phpt block
Pass ini settings when checking loaded extensions
Fix skipifs
* Commands are not properly escaped for windows
* Specifying "-n" to check loaded modules causes "Module already loaded"
warning
* Extensions to be loaded need the "php_" prefix on Windows
Bug: https://bugs.php.net/bug.php?id=75042
Add back -n flag to fetch loaded extensions in run-tests.php
Add test for phpt EXTENSIONS directive
Add a second test for bug 75042
Add test to test loading of nonexistent shared module
with the EXTENSIONS phpt block
Pass ini settings when checking loaded extensions
TS related VCWD routines depend on CWD. Thus, a premature CWD
deactivation renders the VCWD layer unusable. Same issue seems to
persist in versions < 7.2, just that the code path is actually unused so
the issue didn't show up. Still might make sense to backport this into
lower branches.
* PHP_OS_FAMILY is now a macro, to allow extensions to take advantage of it, it is defined in php.h
* Values are not upper-case-first, not always uppercase. Windows is no longer just "Win", if we want the short version for testing then PHP_OS is always WINNT anyway
Fix function names prefix
Use Unicode version of GetFinalPathNameByHandle
Use EG(windows_version_info) instead of RtlGetVersion
Use the specified handle_id instead of STD_OUTPUT_HANDLE
Switch from stream name to stream resource
Allow running tests capturing only stdout and/or stderr
Add tests for stream_vt100_support function
Export Win32 console functions
Fix x64 build
Use zend_long instead of long long, use GetConsole instead of GetFinalPathNameByHandleW to check if a handle is a valid console stream
Always use zend_long on any platform
Use _get_osfhandle to determine the standard handle
Accept stream names
Raise warnings in case of invalid stream parameter
Return true if disabling VT100 support on a not-console/redirected stream or on old Windows versions
Remove php_win32_console_os_supports_vt100
Differentiate stdin vs stdout/stderr
Simplify setting flag
Allow avoid piping STDIN
Let stream_vt100_support accept only resources
Fix run-tests
Revert console flags in case of failure
Simplify logic of stream_vt100_support when setting the flag
Return true if succeeded, false otherwise
Drop support for STDIN
More comprehensive tests for stream_vt100_support
Remove old tests
Fix name of included file and use absolute paths
Enable ENABLE_VIRTUAL_TERMINAL_PROCESSING on Windows by default
Remove tests for stream_vt100_support
Split stream_vt100_support into stream_isatty+sapi_windows_vt100_support
Add tests for stream_isatty
Add tests for sapi_windows_vt100_support
Return null from stream_isatty is neither Windows nor Posix
Fallback to S_ISCHR if neither Windows nor Posix
Avoid defining argc since it's only used once
Better comment about php_win32_console_fileno_is_console
Use events instead of cNumberOfEvents
Do not restore previous console mode
We need to restore previous console mode on failing SetConsole calls only for STDIN
Don't configure STDOUT/STDERR on Windows with PHP_CLI_WIN32_NO_CONSOLE
The special cases (float)"inf", etc. were never intended and are
caused by the updated strtod lib. While it might be nice as an
easy way to produce Inf and NaN special values, it was never
documented and cause BC breaches.
Instead of directly writing to stdout. This allows doing a print_r
into a string, without using output buffering.
The motivation for this is bug #67467: print_r() in return mode
will still dump the string to stdout (causing a potential information
leak) if a fatal error occurs.
Squashed commit of the following:
commit e05d3b6732
Author: Andrea Faulds <ajf@ajf.me>
Date: Wed Mar 30 01:43:35 2016 +0100
UPGRADING and NEWS
commit 6caf1d4585
Author: Andrea Faulds <ajf@ajf.me>
Date: Sun Mar 20 21:18:33 2016 +0000
Fixes
commit 6dadb1b0ef
Author: Andrea Faulds <ajf@ajf.me>
Date: Sun Feb 14 02:15:01 2016 +0000
Add test for numeric string errors in assignment
commit bd5f04e8dd
Author: Andrea Faulds <ajf@ajf.me>
Date: Sat Feb 13 23:53:05 2016 +0000
Add test for numeric string errors
commit c72e92f16d
Author: Andrea Faulds <ajf@ajf.me>
Date: Tue Jan 26 23:28:33 2016 +0000
Add test for scientific notation in integer operations
commit d94c08852d
Author: Andrea Faulds <ajf@ajf.me>
Date: Sun Feb 14 01:25:57 2016 +0000
Disable optimiser evaluation for numeric string errors
commit 30ee954ed1
Author: Andrea Faulds <ajf@ajf.me>
Date: Sun Feb 14 01:46:25 2016 +0000
fixup
commit a6403b79e0
Author: Andrea Faulds <ajf@ajf.me>
Date: Sat Feb 13 22:00:27 2016 +0000
Do not convert error-causing numeric strings ahead-of-time
commit f9dc354014
Author: Andrea Faulds <ajf@ajf.me>
Date: Sat Feb 13 19:15:38 2016 +0000
Disable compile-time evaluation for numeric string errors
commit e05b0cc849
Author: Andrea Faulds <ajf@ajf.me>
Date: Fri Feb 5 11:42:26 2016 +0000
Make _zval_get_long_func_noisy function for inlining
commit 84d66321a5
Author: Andrea Faulds <ajf@ajf.me>
Date: Tue Jan 26 23:10:00 2016 +0000
Update tests
commit 5ac4a0cc4b
Author: Andrea Faulds <ajf@ajf.me>
Date: Tue Jan 26 22:08:19 2016 +0000
Use is_numeric_string_ex for zval_get_long etc.
commit c21f088485
Author: Andrea Faulds <ajf@ajf.me>
Date: Thu Jan 7 21:13:04 2016 +0000
Update tests
commit 63e214cf81
Author: Andrea Faulds <ajf@ajf.me>
Date: Wed Jan 6 00:28:01 2016 +0000
Warn on non-/bad numeric strings in arithmetic
Squashed commit of the following:
commit f11ca0e7a5
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Dec 8 12:38:42 2015 +0300
Fixed test expectation
commit 211f873f54
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue Dec 8 12:28:38 2015 +0300
Embed zend_class_constant.flags into zend_class_constants.value.u2.access_flags
commit 51deab84b2
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon Dec 7 11:18:55 2015 +0300
Fixed issues found by Nikita
commit 544dbd5b47
Author: Dmitry Stogov <dmitry@zend.com>
Date: Sat Dec 5 02:41:05 2015 +0300
Refactored immplementation of https://wiki.php.net/rfc/class_const_visibility
@reeze created an RFC here and I emailed internals here and didn't get any responses positive/negative.
of course we can try to refactor the current flow to make this error can
be catched safly.
but as 7.0.0 is releasing, I don't think a refactor is safe now. and
actually I don't see any gain to make this catchable.
so let's keep this be consistent with 5.6 and safe for now
This fail has nothing together with any changes in run-tests.php
Using run-tests.php from the 5.5 branch brings the same result. So
merely it is about how PHP7 handles and buffers errors.
We currently don't show the argument at which the error actually
occured in the trace - should probably either add it or don't
display args on incomplete frames altogether, otherwise this'll
probably be confusing.
This implements a reduced variant of #1226 with just the following
change:
-Fatal error: Uncaught exception 'EngineException' with message 'Call to private method foo::bar() from context ''' in %s:%d
+Fatal error: Uncaught EngineException: Call to private method foo::bar() from context '' in %s:%d
The '' wrapper around messages is very weird if the exception
message itself contains ''. Futhermore having the message wrapped
in '' doesn't work for the "and defined" suffix of
TypeExceptions.
TypeException stays as-is for now because it uses messages that are
incompatible with the way exception messages are displayed.
closure_038.phpt and a few others now show that we're generating
too many exceptions for compound operations on undefined properties
-- this needs to be fixed in a followup.
Primarily to avoid getting fatal errors from token_get_all().
Implemented using a magic E_ERROR token, which the lexer emits to
force a parser failure.