Commit Graph

1921 Commits

Author SHA1 Message Date
Bob Weinand
f3e124d58d Merge branch 'coroutineDelegation' of https://github.com/bwoebi/php-src 2015-04-14 17:58:58 +02:00
Xinchen Hui
fa0608077b Merge branch 'PHP-5.5' into PHP-5.6 2015-04-10 22:48:36 +08:00
Xinchen Hui
429f411eb3 Fixed bug #69420 (Invalid read in zend_std_get_method) 2015-04-10 22:47:06 +08:00
Nikita Popov
7e9a1c1e3f Merge branch 'PHP-5.5' into PHP-5.6
Conflicts:
	Zend/zend_compile.c
	Zend/zend_compile.h
2015-04-06 22:06:48 +02:00
Nikita Popov
cc70a46525 Fix bug #60022 2015-04-06 22:03:04 +02:00
Dmitry Stogov
cae0147ed3 Fixed weird operators behavior. Division by zero now emits warning and returns +/-INF, modulo by zero and intdid() throws an exception, shifts by negative offset throw exceptions. Compile-time evaluation of division by zero is disabled. 2015-04-06 14:30:05 +03:00
Dmitry Stogov
ec760d8fff Convert fatal errors into EngineExceptions 2015-04-01 20:01:57 +03:00
Dmitry Stogov
8c031a3f95 Handle incorrect break/continue statements at compile-time 2015-04-01 15:52:26 +03:00
Dmitry Stogov
acfc31c0f8 Use zend_error_noreturn() for fatal errors 2015-04-01 13:32:23 +03:00
Nikita Popov
8d00385871 Reclassify E_STRICT notices
Per RFC https://wiki.php.net/rfc/reclassify_e_strict

While reviewing this, found that there are still three E_STRICTs
left in libraries - need to discuss those.
2015-04-01 11:17:55 +02:00
Nikita Popov
6ef9216269 Finish PHP 4 constructor deprecation 2015-03-31 17:55:27 +02:00
Andrea Faulds
db76b708cf Deprecate PHP 4 constructors 2015-03-31 17:55:27 +02:00
Nikita Popov
53a40386bc Implement additional type reservations
* The class names false, true and null are now reserved.
 * The code dealing with reserved class names is now decoupled
   from scalar type hint handling. It also includes self, parent,
   and static, which are class names which were already reserved
   previously.
 * Reuse existing messages for reserved class names.

Fallout: class_alias() can no longer alias self, parent and static.
However this never really worked in the first place, as the test
which was testing this shows.
2015-03-30 22:59:06 +02:00
Xinchen Hui
e60b380c55 Merge branch 'bug69315' of https://github.com/laruence/php-src 2015-03-28 14:10:41 +08:00
Nikita Popov
c64f5e3332 Disallow direct incdec of function return value
Matching PHP 5 behavior.

We may want to support this for by-reference returns, but that
requires implementing further checks.
2015-03-27 16:40:04 +01:00
Xinchen Hui
84d9426730 Fixed bug #69315 2015-03-27 17:50:36 +08:00
Kalle Sommer Nielsen
67b907f059 Change the error message for colliding class/interface/trait names to be a little more clearer.
C:\> php -r "interface stdClass { }"
  Error: Cannot declare interface stdClass, because the name is already in use in Command Line Code on line 1
2015-03-26 01:44:23 +01:00
Kalle Sommer Nielsen
927d53fda4 Change "Cannot redeclare class X" into "Cannot redeclare class/interface/trait X", meaning that the following:
C:\> php -r "trait A { } trait A { }"

Will now properly print "Cannot redeclare trait A" instead of "Cannot redeclare class A" to make error messages a tiny bit clearer. Admittedly, a better solution can most likely be made by actually telling what the colliding object is a type of.

Internally this adds a new function:
 zend_get_object_type()
2015-03-25 06:31:11 +01:00
Dmitry Stogov
23c33b1483 Optimized strings concatenation.
ZEND_ADD_STRING/VAR/CHAR are replaced with ZEND_ROPE_INTI, ZEND_ROPE_ADD, ZEND_ROPE_END.
Instead of reallocation and copying string on each ZEND_ADD_STRING/VAR/CAHR, collect all the strings and then allocate and construct the resulting string once.
2015-03-24 22:47:21 +03:00
Dmitry Stogov
1cfa4db338 Fixed return type hint handling for constants 2015-03-20 18:36:43 +03:00
Dmitry Stogov
44669e8f41 Fixed white spaces 2015-03-20 11:10:29 +03:00
Dmitry Stogov
aee2985f35 Merge branch 'scalar_type_hints_v5' of github.com:ircmaxell/php-src into scalar_type_hints_v5
* 'scalar_type_hints_v5' of github.com:ircmaxell/php-src: (54 commits)
  Add check for maintaining reference all the way through both type and return values
  Reduce the number of times that the zval needs to be separated in return type checking to those that are necessary
  Add test to ensure namespaced code can't use scalar types as class names
  Disallow relative namespace type declarations
  Add support and tests for null constant default values. Refactor complex conditionals into an extracted function for clarity and code-reuse
  Refactor as to not use call info, but add the flag to the op_array.
  Fix severity issues with callbacks, start work porting ZEND_STRLEN opcode to work with strict mode, more refactoring to come
  Fix C89 compatibility by moving a misplaced if statement
  Refactor gotos into more elaborate ifs to eliminate goto failure
  Fix return type separation with references. It now includes a check in the opcode handler and properly separates the value in both cases
  Add error case with invalid type declaration default value
  Add tests for using constants as defaults with scalar type declarations
  Refactor error messages to only append defined in the event of rendering as a fatal error. Fix relative typehints to not work
  Revert gd and mysqli to former calls for arg count errors. Fix first identified issues with zend_compile.c from nikic. Add tests for generator returns prior to first yield
  Style cleanup, as well as fixing bug with missing argument for WRONG_PARAM_COUNT_WITH_RETVAL
  Clean up API renames for zend_wrong_param_count to maintain BC, introducing a zend_wrong_param_count_ex() function when you know strict value
  Fix executor issue with ignoring strict types, which cleans up a bunch of errors. Additionally fix the expected error of 2 unrelated tests that was caused by a change to the core error messages
  Fix more tests, improve error messages in failure output for thrown exception
  Refactor error implementation significantly to centralize error mode behavior. Add zend_internal_type_error() function
  Refactor declare placement detection, allow encoding declares before type declares
  ...
2015-03-20 10:51:41 +03:00
Dmitry Stogov
d146d15003 Optimize zend_string_realloc() add more specialized versions zend_string_extend() and zend_string_truncate() 2015-03-20 02:02:42 +03:00
Anthony Ferrara
aaf0c8b594 Disallow relative namespace type declarations 2015-03-19 14:07:03 -04:00
Anthony Ferrara
7044f9c6df Refactor as to not use call info, but add the flag to the op_array. 2015-03-19 13:30:11 -04:00
Anthony Ferrara
427ecdc5eb Fix return type separation with references. It now includes a check in the opcode handler and properly separates the value in both cases 2015-03-18 18:10:08 -04:00
Anthony Ferrara
724f7118f1 Refactor error messages to only append defined in the event of rendering as a fatal error. Fix relative typehints to not work 2015-03-18 16:38:51 -04:00
Anthony Ferrara
1df033c5cd Revert gd and mysqli to former calls for arg count errors. Fix first identified issues with zend_compile.c from nikic. Add tests for generator returns prior to first yield 2015-03-18 16:14:02 -04:00
Anthony Ferrara
d22bfb8aa6 Merge in master, fix merge conflicts and update patch to support exceptions everywhere 2015-03-18 10:50:11 -04:00
Dmitry Stogov
4e11095438 Reimplemented special constant handling. Now __HALT_COMPILER_OFFSET__ is resolved at compile-time. __CLASS__ retrived using separate ZEND_FETCH_CLASS_NAME opcode. 2015-03-18 15:33:56 +03:00
Dmitry Stogov
a53d82daa6 Prevent possible double inheritance (ext/opcache/tests/bug67215.phpt) 2015-03-10 18:50:07 +03:00
Xinchen Hui
1638db71fd Declares in top 2015-03-09 00:01:55 +08:00
Márcio Almada
22d6cc7c8c fix compilation warnings, rename batch_use to group_use 2015-03-08 12:50:57 -03:00
Márcio Almada
fbde890ee2 allow non mixed use declarations, CC @nikic #1005
```
use function N\S { foo, bar, etc };
use const N\S { FOO, BAR, ETC };
```

Related tests:

```
make test -j4 TESTS="-m Zend/tests/ns_0{88..92}*.phpt"
```

All namespace tests:

```
make test -j4 TESTS="Zend/tests/ns_*.phpt"
```
2015-03-07 17:59:48 -03:00
Márcio Almada
275e7276c1 first implementation of batch use compilation 2015-03-07 17:59:48 -03:00
Márcio Almada
39b0e2c90d fix typo 2015-03-07 17:59:48 -03:00
Xinchen Hui
e8e5913e5e Merge branch 'PHP-5.5' into PHP-5.6 2015-03-05 21:06:07 +08:00
Xinchen Hui
869f8bd24b Error also maybe happened here 2015-03-05 21:05:26 +08:00
Xinchen Hui
168be6f250 Merge branch 'PHP-5.5' into PHP-5.6 2015-03-05 18:40:06 +08:00
Xinchen Hui
f039225597 Fixed bug #69174 (leaks when unused inner class use traits precedence) 2015-03-05 18:39:50 +08:00
Dmitry Stogov
13eed2676d Merge commit 'refs/pull/1137/head' of git://github.com/php/php-src
* git://github.com/php/php-src:
  Optimize class constant declare compilation
2015-03-04 18:07:07 +03:00
Dmitry Stogov
8ec8648c91 Improved code for class property inheritance 2015-03-04 17:41:01 +03:00
Xinchen Hui
2fa4d1d88b Fixed wrong type used 2015-03-04 10:55:14 +08:00
Reeze Xia
badc19d884 Optimize class constant declare compilation 2015-03-03 21:28:09 +08:00
Dmitry Stogov
9a20323e19 Improved assert() according to expectations RFC.
See https://wiki.php.net/rfc/expectations

Squashed commit of the following:

commit 3f3651a787
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Mar 2 11:56:33 2015 +0300

    opcode 137 is used for ZEND_OP_DATA and con't be reused for ZEND_ASSERT_CHECK

commit ca8ecabf2a
Merge: 24328ac 9dac923
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Mar 2 10:49:23 2015 +0300

    Merge branch 'master' into assert

    * master:
      Update NEWS
      Fixed bug #69139 (Crash in gc_zval_possible_root on unserialize)
      windows only test
      Align entries format
      Align entries format for 5.6.7
      Align entries format for 5.5.23
      Bump header year
      Fixed bug #69144 (strtr not replacing with partly matching replace pairs)
      Fixed test?
      Revert mktime()/gmmktime()'s arginfo
      Update NEWS
      Fixed bug #69141 Missing arguments in reflection info for some builtin functions
      Add NEWS entry
      Remove useless date warning
      Fix ARG_INFO for levenshtein
      Fix ARG_INFO for levenshtein
      fix dir separator in tests
      Update NEWS
      Fixed bug #69085 (SoapClient's __call() type confusion through unserialize()).

commit 24328ac03f
Merge: 021fd94 1cdee9a
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Feb 27 15:57:13 2015 +0300

    Merge branch 'master' into assert

    * master:
      Fixed C++ support
      Fixed bug #69115 crash in mail
      Reorder
      Update NEWs
      Fixed bug #69121 (Segfault in get_current_user when script owner is not in passwd with ZTS build)
      Update News
      Fixed bug #69125 (Array numeric string as key)
      fix bug#68942's patch
      Fixed ability to build unspecialized executor
      Fixed bug #69124 (method name could not be used when by ref)
      Fixed a bug that header value is not terminated by '\0' when accessed through getenv().
      Fixed a bug that header value is not terminated by '\0' when accessed through getenv().

commit 021fd94ed1
Merge: 49963eb ace1f82
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Feb 26 11:26:03 2015 +0300

    Merge branch 'master' into assert

    * master: (59 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
      ...

    Conflicts:
    	Zend/zend_vm_execute.h
    	Zend/zend_vm_opcodes.c
    	Zend/zend_vm_opcodes.h

commit 49963ebf9d
Merge: 07b1f92 6b77959
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Feb 19 11:13:08 2015 +0300

    Merge branch 'master' into assert

    * master:
      Implemented AST pretty-printer
      update NEWS to match the actual stuff in 5.6.6
      update NEWS to match the actual stuff in 5.5.22
      update NEWS(add missing entry for the enchant fix, and reorder the entries a bit)
      fix typo in bug#
      update NEWS
      fix email format
      update NEWS
      update 5.6.6 release date in NEWS
      Fix bug #69033 (Request may get env. variables from previous requests if PHP works as FastCGI)
      BFN
      fix test
      fix test
      fix test
      Fixed bug #65593 (Segfault when calling ob_start from output buffering callback)
      Updated NEWS
      add CVE
      5.4.39 next
      Fix associativity to match Perl
      Blast off to space.

    Conflicts:
    	Zend/zend_ast.c

commit 07b1f92ed6
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 23:06:32 2015 +0300

    fixed pretty-printer (support for "elseif")

commit 5a976c8d85
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 19:50:08 2015 +0300

    Fixed vaeious ptetty-printer issues

commit 69491e8e8e
Merge: 8473157 3ddc246
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 10:18:32 2015 +0300

    Merge branch 'master' into assert

    * master:
      Set PHP_JSON_VERSION to 1.4.0
      Remove unnecessary resource checks in openssl ext
      JSON is now maintained

commit 8473157fbb
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 10:17:26 2015 +0300

    Fixed typo and white spaces

commit 96de5ffc8d
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Feb 18 00:28:39 2015 +0300

    Fixed assert() in namesapaces

commit 5eba069c28
Merge: 4a2d9c0 d428bf2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Feb 17 22:45:55 2015 +0300

    Merge branch 'master' into assert

    * master: (25 commits)
      improve debugability in TS debug builds
      More UPGRADING, in particular on foreach
      Fixed bug #69038 (switch(SOMECONSTANT) misbehaves) for master
      Replace var is introduced
      abstain from using xmlCleanupParser
      fix TS build
      Fix bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone)
      update news
      Fix bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone)
      Port for for bug #68552
      Fix bug #68942 (Use after free vulnerability in unserialize() with DateTimeZone)
      Update NEWS
      Fixed bug #69038 (switch(SOMECONSTANT) misbehaves)
      - BFN
      Don't read the local php.ini when Generating Phar When building phar shared, you can end up loading a previous phar.so that isn't compatible with the php cli being used to generate Phar here.
      - Fixed bug #67827 (broken detection of system crypt sha256/sha512 support)
      Delete json outdated package.xml
      made ZEND_TSRMLS_CACHE_* macros look like function calls
      - Fix merge
      - Fixed bug #67427 (SoapServer cannot handle large messages) patch by: brandt at docoloc dot de
      ...

commit 4a2d9c0953
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue Feb 17 22:45:10 2015 +0300

    Implemented AST pretty-printer to capture expression passed to assert()

commit 7a059b66d5
Merge: 9973df7 3892eba
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Feb 16 18:42:28 2015 +0300

    Merge branch 'expect' of github.com:krakjoe/php-src into assert

    * 'expect' of github.com:krakjoe/php-src:
      import expect

    Conflicts:
    	Zend/zend_compile.c
    	Zend/zend_execute_API.c
    	Zend/zend_globals.h
    	Zend/zend_vm_def.h
    	Zend/zend_vm_execute.h
    	Zend/zend_vm_opcodes.c
    	Zend/zend_vm_opcodes.h
    	ext/opcache/Optimizer/block_pass.c
    	ext/opcache/Optimizer/pass1_5.c
    	ext/standard/assert.c
    	ext/standard/tests/assert/assert_error3.phpt

commit 3892eba2bf
Author: krakjoe <joe.watkins@live.co.uk>
Date:   Sun Feb 2 12:49:35 2014 +0000

    import expect
2015-03-02 12:25:40 +03:00
Nikita Popov
fcdb6e0811 WIP 2015-02-28 21:20:37 +01:00
Dmitry Stogov
c2c78dc963 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)
2015-02-25 10:37:21 +03:00
Dmitry Stogov
5f278e4d3a Use cache_slot offsets instead of indexes (simplify run-time instructions) 2015-02-25 01:52:35 +03:00
Dmitry Stogov
dcb96c2e03 Split INIT_FCALL_BY_NAME inti INIT_FCALL_BY_NAME(CONST+STRING) and INIT_DYNAMIC_CALL(CONST-STRING|TMPVAR|CV) 2015-02-24 22:29:47 +03:00
Nikita Popov
bdf1430eeb Support list($a, $b) = $a
By compiling the RHS $a as a non-CV fetch.

This worked as expected in PHP 5, but broke in PHP 7 due to the
different assign order. However the new implementation is more
general, in that it allows $a on the LHS in any place, not just
the first element.
2015-02-24 19:08:23 +01:00
Anthony Ferrara
7c8d1e0bd7 Refactor declare placement detection, allow encoding declares before type declares 2015-02-20 15:56:58 -05:00
Anthony Ferrara
dc35868a77 Merge branch 'master' into scalar_type_hints_v5 2015-02-20 13:33:35 -05:00
Xinchen Hui
09ac3e931c uint32_t 2015-02-21 01:19:07 +08:00
Anthony Ferrara
b3be3c5b17 Clean up tri-state logic to use break instead 2015-02-20 11:54:33 -05:00
Anthony Ferrara
e3b020b945 Fix declare error behavior so that improper usages will actually error 2015-02-20 11:43:18 -05:00
Dmitry Stogov
5f76eed14e don't count op_arrays stored in opcache SHM 2015-02-20 14:59:30 +03:00
Dmitry Stogov
d85113702c Lazy duplication of op_array->static_variables 2015-02-20 13:28:26 +03:00
Anthony Ferrara
c859079962 Remove the aliases of scalar types 2015-02-18 16:43:39 -05:00
Anthony Ferrara
c6996a2988 Fix default values for booleans, thanks to virtual types 2015-02-18 16:34:43 -05:00
Anthony Ferrara
d5aaebc355 Disallow block mode for declare(strict_types=1) declarations 2015-02-18 12:43:57 -05:00
Anthony Ferrara
ac2ece885f Improve detection of strict_types declaration being first in the file 2015-02-18 11:40:52 -05:00
Anthony Ferrara
e2053fa94c Fix bug where return type checking was overzealous and interfered with generators 2015-02-18 10:59:33 -05:00
Anthony Ferrara
9109e48749 Merge in master 2015-02-18 10:35:39 -05:00
Anthony Ferrara
00b3e77ead Move declare() to the top of the file only, and allow int->float generalization 2015-02-18 10:26:29 -05:00
Dmitry Stogov
e10e151e9b Merged zend_array and HashTable into the single data structure.
Now each HashTable is also zend_array, so it's refcounted and may be a subject for Copy on Write
zend_array_dup() was changed to allocate and return HashTable, instead of taking preallocated HashTable as argument.
2015-02-13 22:20:39 +03:00
Nikita Popov
03ded8c7ea Remove unused variable 2015-02-13 15:33:50 +01:00
Guilherme Blanco
4498d34aea Check interface/trait extension for internal classes
Removed possibility to have extensions to declare classes extending
interfaces or traits. It was checked in user classes, not extensions
or internal.
2015-02-13 15:31:48 +01:00
Xinchen Hui
da7d94cd73 Merge branch 'PHP-5.6'
Conflicts:
	ext/soap/soap.c
	ext/standard/basic_functions.c
	ext/zlib/zlib.c
2015-02-13 13:28:24 +08:00
Guilherme Blanco
8c81d80e10 Made ZEND_ACC_TRAIT a saner value
CC_TRAIT valued as 0x120 is too magical to be comprehensible by others.
2015-02-12 23:20:19 +01:00
Dmitry Stogov
97fe15db43 Fix "forech" statemt behaviour according to https://wiki.php.net/rfc/php7_foreach
Squashed commit of the following:

commit 1e41295097
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Sat Jan 31 07:28:58 2015 +0300

    Generalize HashTableIterator API to allows its usage without involvement of HashTable.nInternalPonter

commit 5406f21b11
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 18:08:43 2015 +0300

    Reduced alghorithms complexity

commit b37f1d58d2
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 18:08:30 2015 +0300

    Fixed test name

commit fb2d079645
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 18:08:05 2015 +0300

    API cleanup

commit 08302c0d6d
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 14:20:46 2015 +0300

    Make array_splice() to preserve foreach hash position

commit cc4b7be41e
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 12:24:31 2015 +0300

    Make internal function, operation on array passed by reference, to preserve foreach hash position

commit 5aa9712b0a
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 09:49:35 2015 +0300

    Implement consistent behavior for foreach by value over plain object

commit 4c5b385ff5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Jan 30 07:56:37 2015 +0300

    More careful iterators update.

commit 721fc9e80d
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jan 29 21:43:28 2015 +0300

    Added new test

commit 15a23b1218
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jan 29 21:05:02 2015 +0300

    Reimplement iteration magic with HashTableIterators (see https://wiki.php.net/rfc/php7_foreach#implementation_details)

commit 10a3260b1f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jan 29 21:04:44 2015 +0300

    New test

commit eef80c5837
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 16:52:21 2015 +0300

    Fixed foreach by reference iteration over constant array

commit 61e7391873
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 14:59:54 2015 +0300

    Fixed temporary variable re-allocation pass

commit 92e90c09f0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 12:44:57 2015 +0300

    Fixed operand destruction in case of exceptions in iterator

commit dd2a36a207
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 10:02:34 2015 +0300

    Use GET_OP1_ZVAL_PTR_DEREF() (IS_TMP_VAR and IS_CONST can't be IS_REFERENCE)

commit 4638f7b914
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jan 28 07:43:28 2015 +0300

    Change "foreach" statement behavior (this is just a PoC yet)

    - "foreach by value" don't relay on internal array/object pointer and doesnt perform array duplication. It just locks it incrementing reference counter. If the original array is modified by some code, the copy on write is performed and "foreach" still work with the old copy.

    - it makes no difference if array given to "foreach by value" is reference itself

    - "foreach by reference" still use internal array/object pointer and should work similar to PHP-5. (This id not completely implemented)
2015-02-12 13:57:12 +03:00
Xinchen Hui
4f1fc31e16 Expose zend_string_equals_str_ci 2015-02-11 16:05:20 +08:00
Bob Weinand
2b3bebfa4c Revert removal of two ReflectionParameter functions
Rather fix them for now by exempting function parameter defaults from *any* (non-ct) constant substitution (also from persistent constant substitution, which was already broken before)
2015-02-10 22:20:53 +01:00
Andrea Faulds
5a7ac0fade Implement per-file strictness for scalar return types 2015-02-10 15:48:09 +00:00
Andrea Faulds
6b6b2b4b7c Implement scalar return types (strict only for now) 2015-02-10 15:48:09 +00:00
Andrea Faulds
c7719ab4e5 Refactor typehint lookup 2015-02-10 15:48:08 +00:00
Andrea Faulds
e1a238670c Shorten syntax to strict_types=1 2015-02-10 15:48:07 +00:00
Andrea Faulds
02ec3572d9 Per-file 2015-02-10 15:48:06 +00:00
Andrea Faulds
cc01e37e54 It Begins 2015-02-10 15:48:06 +00:00
Andrea Faulds
1a28ad036e Forbid scalar type hint names for use, class_alias 2015-02-10 15:48:05 +00:00
Andrea Faulds
a03af7ff92 Fix class name prohibition to work for namespaced classes, too 2015-02-10 15:48:05 +00:00
Andrea Faulds
75a225d0d5 Do not make scalar type hints reserved words, merely reserve class name 2015-02-10 15:48:05 +00:00
Bob Weinand
830d3d79b3 Revert "Revert "Improve and generalize class constant substitution""
This reverts commit 400e65e955.

Removing ReflectionParameter::getDefaultValueConstantName() and isDefaultValueConstant()
They become useless with such optimizations and already anyway are (e.g. CONSTANT?:CONSTANT ... yields the constant back without telling isDefaultValueConstant() about it etc.)
2015-02-10 15:47:17 +01:00
Bob Weinand
400e65e955 Revert "Improve and generalize class constant substitution"
This reverts commit 9ff3800b79.
2015-02-09 22:44:25 +01:00
Bob Weinand
9ff3800b79 Improve and generalize class constant substitution 2015-02-09 17:11:23 +01:00
Dmitry Stogov
9e70d7672d 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. 2015-02-04 15:24:13 +03:00
Dmitry Stogov
6720716682 Optimize class lookup 2015-02-03 17:39:05 +03:00
Dmitry Stogov
e375ba877a Fixed "delayed" compilation 2015-02-02 20:44:16 +03:00
Dmitry Stogov
638d0cb753 Merge branch 'typed_returns' of github.com:morrisonlevi/php-src into test
* 'typed_returns' of github.com:morrisonlevi/php-src:
  Implement return types
2015-01-28 06:56:19 +03:00
Levi Morrison
c8576c5a46 Implement return types
RFC is documented here: https://wiki.php.net/rfc/return_types
2015-01-27 11:49:56 -07:00
Nikita Popov
4d3e4d3bf9 Remove assignment of new by reference 2015-01-26 21:00:22 +01:00
Bob Weinand
c637ba118e Fix segfault when no class ctx is defined 2015-01-24 20:00:46 +01:00
Nikita Popov
8dc1287739 Fix build 2015-01-24 19:53:07 +01:00
Bob Weinand
f3675d950d Inline self-constants if possible at compile time 2015-01-24 19:19:02 +01:00
Bob Weinand
bd629428a6 Removed efree() on arena_alloc()ed memory 2015-01-21 23:52:48 +01:00
Xinchen Hui
8d60d37001 Unused var 2015-01-20 11:58:40 +08:00
Dmitry Stogov
230bfb1067 Generate better code for comparisons with boolean constants 2015-01-19 17:02:17 +03:00
Dmitry Stogov
2efa53649e Optimize code generated for "while" and "for" loops.
Eliminate one JMP opcode for each loop iteration.
2015-01-19 13:27:44 +03:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
0579e8278d bump year 2015-01-15 23:26:37 +08:00
Xinchen Hui
73c1be2653 Bump year 2015-01-15 23:26:03 +08:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Nikita Popov
e9068cefb4 Make empty list() check stricter
Now also includes list()s with just commas in it.
2015-01-09 18:27:06 +01:00
Guilherme Blanco
d51fb69c01 Removed parsing support traits to have extends and implements. 2015-01-09 15:45:02 +01:00
Guilherme Blanco
f48c232740 Decoupled class declaration statement into more granular pieces. 2015-01-09 15:45:01 +01:00
Nikita Popov
2269b1801d Add missing string cast for non-cv var fetches 2015-01-04 18:07:44 +01:00
Nikita Popov
69a4b135f3 Fix use after free for variables with integer names 2015-01-04 17:57:23 +01:00
Xinchen Hui
3bd96e0735 Use internd string as key 2014-12-29 14:35:08 +08:00
Dmitry Stogov
c42ac09518 Added new API function 'zend_string* zend_string_tolower(zend_string*)'.
It simplifies code and avoids unnecessary allocation and copying if string is already in lower case.
2014-12-24 15:04:51 +03:00
Dmitry Stogov
2646f7bcb9 Don't count variadic argument in zend_func.common.num_args. This allows faster CALL/RETURN code. 2014-12-22 16:44:39 +03:00
Nikita Popov
0f815642e0 Drop ZEND_PRINT opcode in favor of ZEND_ECHO
The return value long(1) is an IS_CONST operand now.
2014-12-18 14:39:40 +01:00
Anatol Belski
2eef2abee5 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  Optimize argument passing handlers:
  Fix pcre non-FAST_ZPP build

Conflicts:
	Zend/zend_compile.c
	Zend/zend_execute.h
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
	ext/pcre/php_pcre.c
2014-12-16 17:13:47 +01:00
Dmitry Stogov
3a18597774 Optimize argument passing handlers:
- predcalculate offsets of passed argument and store it in opline->result.var for ZEND_SEND_*;
- don't update "number of passed arguments" op each ZEND_SEND_* opcode, store it on call frame creation
- Change ZEND_HANDLE_EXCEPTION to determine "number of passed arguments" in incomplete calls fefore freeing
2014-12-16 18:40:52 +03:00
Anatol Belski
0a40e6a3db removed the TS part, as suggested by Dmitry.
Tests seem to be ok so far
2014-12-14 19:12:13 +01:00
Anatol Belski
e112f6a04e second shot on removing TSRMLS_* 2014-12-14 14:07:59 +01:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Anatol Belski
bb66f385d0 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (37 commits)
  NEWS
  NEWS
  Fix bug #68601 buffer read overflow in gd_gif_in.c
  Fixed compilation warnings
  Removed unnecessary checks
  pcntl_signal_dispatch: Speed up by preventing system calls when unnecessary
  Merged PR #911.
  Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently defined classes as final which were just not being considered as such before.
  Updated NEWS
  Updated NEWS
  Updated NEWS
  Fix bug #68532: convert.base64-encode omits padding bytes
  Updated NEWS
  Updated NEWS
  Updated NEWS
  Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor)
  Updated NEWS
  Updated NEWS
  Fix MySQLi tests
  Fixed gd test
  ...
2014-12-13 19:43:45 +01:00
Dmitry Stogov
3893c1fc3d Fixed compilation warnings 2014-12-12 21:57:34 +03:00
Julien Pauli
d5dd29ce5c Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Updated NEWS
  Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor)

Conflicts:
	Zend/zend_compile.c
2014-12-12 16:11:26 +01:00
Kévin Dunglas
ee226b961c Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor) 2014-12-12 14:58:23 +01:00
Anatol Belski
dfb18b1188 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  updated NEWS
  PowerPC64 support for add and sub with overflow check
  PowerPC64 support for operators with overflow check
  Fixed bug #68583 Crash in timeout thread
  Reduced size of zend_op on 64-bit systems.
  Make ZEND_INIT_FCALL keep predcalculted size of necessary stack space in opline->op1.num to avoid its recalculation on each execution.
  Removed unused variables
  Improved array_merge() and array_replace() (1-st array may be added using simple procedure).
  Replaced zendi_convert_to_long() with _zval_get_long_func()
  Moved zend_is_true() from zend_execute.h/zend_execute_API.c into zend_operators.h/zend_operators.c. Splited the most expensive part of inline i_zend_is_true() into a separate zend_object_is_true(). Replaced zendi_convert_to_long() with cals to zend_is_true().
  Revert "Save one xor instr"
  Save one xor instr

Conflicts:
	Zend/zend_execute_API.c
2014-12-12 14:25:59 +01:00
Dmitry Stogov
14e29f5146 Reduced size of zend_op on 64-bit systems.
the main idea - the smaller the zend_op structure, the lees memory traffic is required to load VM instructions during execution. The patch reduces the size of each opcode from 48 to 32 bytes (saves 16 bytes for each opcode, and applications use thousands of opoceds). This reduced the number of CPU cache misses by 12% and improved performance of real-life apps by 1-2%.

The patch affects how constants and jump targets are represented in VM during execution. Previously they were implemented as absolute 64-bit pointers. Now they are relative 32-bit offsets.

In run-time constant now should be accessed as:
  RT_CONSTANT(op_array, opine->op1) instead of opline->op1.zv
  EX_CONSTANT(opline->op1) instead of opline->op1.zv

Jump targets:
  OP_JMP_ADDR(opline, opline->op2) instead of opline->op2.jmp_addr

The patch doesn't change zend_op representation for 32-bit systems. They still use absolute addresses. The compile-time representation is also kept the same.
2014-12-12 10:19:41 +03:00
Dmitry Stogov
9ea35a37b9 Make ZEND_INIT_FCALL keep predcalculted size of necessary stack space in opline->op1.num to avoid its recalculation on each execution. 2014-12-12 09:01:42 +03:00
Anatol Belski
88bb9fedc4 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (111 commits)
  Fix zend_fcall_info_arg*() to use ZVAL_COPY
  Fixed #65213 - cannot cast SplFileInfo to boolean
  add initial install
  switch to C travis project instead of PHP
  use the generic TRAVIS environment var to check for travis (see http://docs.travis-ci.com/user/ci-environment/)
  fix TS build
  add config option to target codegen architectures
  updated NEWS
  updated NEWS
  Fixed bug #55541 errors spawn MessageBox, which blocks test automation
  Get rid of duplicate handlers (ZEND_ADD_SPEC_TMP_TMP and ZEND_ADD_SPEC_VAR_VAR are absolutely the same).
  Use zend_string* for op_array->arg_info[]->name and op_array->arg_info[]->class_name. For internal functions we still use char*.
  Fixed __debugInfo() support
  Update UPGRADING for the new variadic functions, and re-sort.
  Improved POST INC/DEC
  make sure that we don't truncate the stack trace and cause false test failures when the test is executed in a directory with long path
  Missed closed folder mark
  Revert "Unecessary assignment"
  Fixed improper memory release
  Unecessary assignment
  ...
2014-12-05 03:50:02 +01:00
Dmitry Stogov
5dd427eac2 Use zend_string* for op_array->arg_info[]->name and op_array->arg_info[]->class_name. For internal functions we still use char*. 2014-12-03 16:56:09 +03:00
Xinchen Hui
5f80df0dbe Missed closed folder mark 2014-12-02 22:21:19 +08:00
Julien Pauli
96f2265d58 Merge branch 'PHP-5.6'
* PHP-5.6:
  updated NEWS
  updated NEWS
  Fix #65419 - Inside trait, self::class != __CLASS__

Conflicts:
	Zend/zend_compile.c
2014-11-28 13:31:53 +01:00
Julien Pauli
b248a7a95c Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  updated NEWS
  Fix #65419 - Inside trait, self::class != __CLASS__
2014-11-28 13:26:53 +01:00
Julien Pauli
7c77ca38b1 Fix #65419 - Inside trait, self::class != __CLASS__ 2014-11-28 13:24:25 +01:00
Dmitry Stogov
dcfe58773e Rename EX_VAR_2() into ZEND_CALL_VAR() and EX_VAR_NUM_2() into ZEND_CALL_VAR_NUM(). 2014-11-28 11:11:33 +03:00
Anatol Belski
864cd82ace Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  updated NEWS
  refactored the mbstring config.w32
  Update NEWS
  Fixed compilation warnings
  Fixed bug #68504 --with-libmbfl configure option not present on Windows
  Changed "finally" handling. Removed EX(fast_ret) and EX(delayed_exception). Allocate and use additional IS_TMP_VAR slot on VM stack instead.
  the darwin specific test fails for me with the same output which is the expected for the original test I couldn't find anybody who managed to see this test passing, but I found a bunch of other reports on qa.php.net/reports and on google which do see this test failing on mac. if this change causes you to have this test failing on Mac, please drop me a mail so we can improve the current test so it passes for everybody.
  #68446 is fixed
  Reimplemented silence operator (@) handling on exceptions. Now each silence region is stored in op_array->brk_cont_array. On exception ZEND_HANDLE_EXCEPTION handler traverse this array and restore original EG(error_reporting) if exception occured inside a "silence" region.
  remove the NEWS entries for the reverted stuff
  typo fix
  go back with phpdbg to the state of 5.6.3, reverting the controversial commits(remote debugging/xml protocol)
  5.5.21 now
  New label length test
  Fix ext/filter/tests/033.phpt
  Fix filter_list test
  FILTER_VALIDATE_DOMAIN and RFC conformance for FILTER_VALIDATE_URL

Conflicts:
	ext/mbstring/config.w32
2014-11-27 15:59:43 +01:00
Dmitry Stogov
109baa0394 Fixed compilation warnings 2014-11-27 12:52:31 +03:00
Dmitry Stogov
216ef32173 Changed "finally" handling. Removed EX(fast_ret) and EX(delayed_exception). Allocate and use additional IS_TMP_VAR slot on VM stack instead. 2014-11-27 09:56:43 +03:00
Dmitry Stogov
303d73ecd2 Reimplemented silence operator (@) handling on exceptions. Now each silence region is stored in op_array->brk_cont_array. On exception ZEND_HANDLE_EXCEPTION handler traverse this array and restore original EG(error_reporting) if exception occured inside a "silence" region. 2014-11-26 22:44:58 +03:00
Anatol Belski
3ca0ca1548 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (102 commits)
  fix dir separator in test
  fix TS build
  fix TS build
  Better fix for bug #68446
  Revert "Merge remote-tracking branch 'origin/PHP-5.6'"
  Revert NEWS and set test to XFAIL
  Revert "Fix bug #68446 (bug with constant defaults and type hints)"
  Improved zend_hash_clean() and added new optimized zend_symtable_clean()
  Use inline version of zval_ptr_dtor()
  Added new optimized zend_array_destroy() function
  Moved i_zval_ptr_dtor() from zend_execute.h to zend_variables.h
  fix REGISTER_NS_*_CONSTANT macros
  Removed useless assert. EG(uninitialized_zval) can't be refcounted.
  Use specialized destructors when types of zvals are known.
  move tests into proper place
  Improved assignment to object property
  Reuse zend_assign_to_variable() in zend_std_write_property()
  cleanup comments from svn/cvs era
  fix dir separator in test
  fork test for windows
  ...
2014-11-26 08:17:35 +01:00
Dmitry Stogov
1c569b41d5 Merge branch 'PHP-5.6'
* PHP-5.6:
  Better fix for bug #68446
2014-11-25 18:12:30 +03:00
Dmitry Stogov
e116595e63 Better fix for bug #68446 2014-11-25 18:09:08 +03:00
Dmitry Stogov
83ce1d9a78 Revert "Merge remote-tracking branch 'origin/PHP-5.6'"
This reverts commit 38229d13d1, reversing
changes made to 77f172725a.
2014-11-25 15:40:08 +03:00
Bob Weinand
aba95c2399 Revert "Fix bug #68446 (bug with constant defaults and type hints)"
This reverts commit 5ef138b0c7.
2014-11-25 12:24:29 +01:00
Bob Weinand
38229d13d1 Merge remote-tracking branch 'origin/PHP-5.6'
Conflicts:
	Zend/zend_compile.c
	Zend/zend_execute.c
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2014-11-23 23:50:47 +01:00
Bob Weinand
5ef138b0c7 Fix bug #68446 (bug with constant defaults and type hints) 2014-11-23 21:10:41 +01:00
Julien Pauli
ab3525c401 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix #68185 - Inconsistent insteadof definition

Conflicts:
	Zend/zend_compile.c
2014-11-21 15:50:27 +01:00
Julien Pauli
cd3b46f28a Fix #68185 - Inconsistent insteadof definition 2014-11-21 15:37:33 +01:00
Anatol Belski
c6bad96f30 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (398 commits)
  NEWS
  add test for bug #68381
  Fixed bug #68381 Set FPM log level earlier during init
  proper dllexport
  move to size_t where zend_string is used internally
  fix some datatype mismatches
  return after the warning, to fix uninitialized salt usage
  fix datatype mismatches
  add missing type specifier
  fix datatype mismatches
  fix unsigned check
  "extern" shouldn't be used for definitions
  joined identical conditional blocks
  simplify fpm tests
  SEND_VAR_NO_REF optimization
  Add test for bug #68442
  Add various tests for FPM - covering recent bugs (68420, 68421, 68423, 68428) - for UDS - for ping and status URI - for multi pool and multi mode
  Include small MIT FastCGI client library from https://github.com/adoy/PHP-FastCGI-Client
  Get rid of zend_free_op structure (use zval* instead). Get rid of useless TSRMLS arguments.
  Add new FPM test for IPv4/IPv6
  ...

Conflicts:
	win32/build/config.w32
2014-11-18 21:18:52 +01:00
Dmitry Stogov
e20a727430 SEND_VAR_NO_REF optimization 2014-11-18 14:37:36 +03:00
Anatol Belski
09aa419d13 initialiize opline for the case it lands in default case 2014-11-10 23:30:11 +01:00
Xinchen Hui
44bc735a62 convert_to_string also does the check 2014-11-10 23:41:55 +08:00
Xinchen Hui
84cd04fca0 A better fix(do the convertion in compile time) 2014-11-10 23:35:45 +08:00
Anatol Belski
073c5e0997 fix warning not all control paths return a value 2014-10-31 19:36:21 +01:00
Anatol Belski
c51a42076c Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (214 commits)
  fix datatype mismatch warnings
  fix datatype mismatches
  fix datatype mismatches
  fix datatype mismatches
  fix datatype mismatch warnings
  fix datatype mismatch warnings
  fix datatype mismatch warnings
  fix datatype mismatch warning
  fix datatype mismatches
  fix datatype mismatch warnings
  Re-add phpdbg to travis
  Added some NEWS
  Make xml valid (missing space between attrs)
  Fix info classes file name in xml
  Add note about <eval> tag for errors in xml.md
  Name the tag <eval> if the error id during ev cmd
  Do not print out xml as PHP print...
  Fix output to wrong function
  Fixed parameter order on %.*s
  Too much copypaste...
  ...
2014-10-24 22:28:32 +02:00
Anatol Belski
283947af74 fix datatype mismatches
and convert APIs to size_t where zend_string internally used
2014-10-24 20:50:08 +02:00
Dmitry Stogov
6e396961c5 Fixed "instanceof" with undefined classes 2014-10-23 14:50:57 +04:00
Dmitry Stogov
4fd435abab Embed FETCH_CLASS <string> into the following NEW 2014-10-23 11:52:34 +04:00
Dmitry Stogov
8dedd863bc Get rid of ZEND_FETCH_MAKE_REF 2014-10-22 21:45:02 +04:00
Dmitry Stogov
534d854fb2 Embed FETCH_CLASS <string> into the following INSTANCEOF 2014-10-22 17:23:43 +04:00
Dmitry Stogov
779ca61e32 Don't use opline->extended_value for FETCH_CLASS flags where it's unnecessary 2014-10-22 17:22:21 +04:00
Dmitry Stogov
fe8577efb1 Optimized ASSIGN_DIM and related opcodes 2014-10-21 19:30:43 +04:00
Anatol Belski
c00424e427 bring back all the TSRMLS_FETCH() stuff
for better comparability with the mainstream
2014-10-15 09:37:55 +02:00
Anatol Belski
19c41e1f53 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  We can't eliminate FETCH_CONSTANT opcodes for constants represented by AST.
  Ensure __LINE__ is always accurate
  Fix incdec of referenced properties
  Fix ::jsonSerialize() failure message
  Fix invalid zend_string_frees in reflection
  Remove retval member in spl_dllist
  DLL export several APIs needed for phpdbg
  More fixes for nodelist array access - testing for null property read - no zval copying if the type is already long - memory fix for master
2014-10-13 13:52:31 +02:00
Nikita Popov
0b09ba84b9 Ensure __LINE__ is always accurate 2014-10-12 20:55:52 +02:00
Anatol Belski
60f0695a09 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (42 commits)
  Add tests verifying calls work inside echo, concatenation and array access
  Updated NEWS and UPGRADING
  Fix $this CV init for include/eval
  Fix dynamic calls to static methods with fci->object
  Fix $arr =& $arr[0]
  Add UPGRADING stubs for a number of recent changes
  Regenerate tokenizer data
  Fix unused variable warning
  Remove <% and <script language="php"> tags
  zend_uint -> uint32_t
  Fix nesting for *non*-compile-time-resolveable functions See a1a4ba9511 (commitcomment-7414223)
  Add tests for calls to nested, *non*-compile-time-resolveable functions See a1a4ba9511 (commitcomment-7414362)
  Make list of opcodes used for nesting calculation consistent   with `zend_do_convert_call_user_func()` in Zend/zend_compile.c
  Rewrite code to use ZEND_VM_JMP() instead of repeated ZEND_VM_INC_OPCODE() calls
  QA: Simplify code to find matching ZEND_DO_FCALL_BY_NAME CG(context).nested_calls is stored inside the initializer's result.num and inside the finalizer's op2.num, by comparing these we don't need to count manually, and are thus safer from future expansion with specialized opcodes e.g.
  Fix expected fatal error, now is catchable fatal
  Adjust expected fatal error message Now also includes "on [TYPE]" after merge from master
  Check for memory leaks when not using return value
  Adjust expected fatal error message Now also includes "on [TYPE]" after merge from master
  Add tests with arrays as parameters
  ...
2014-10-06 08:42:53 +02:00
Nikita Popov
292421d3a1 Fix unused variable warning 2014-10-05 21:58:38 +02:00
Anatol Belski
a91d3580a7 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  properly export tsrm_strtok_r()
  Fixed list() behavior inconsistency (string handling is disabled for all cases, ArrayAccess objects handling is enabled for all cases, ZEND_FETCH_DIM_TMP_VAR opcode is renamed into ZEND_FETCH_LIST, ZEND_FETCH_ADD_LOCK flag is removed).
  Fix accidental edit in previous commit
  Fix arginfo
  DateTimeZone::getOffset() now accepts a DateTimeInterface
  DateTimeZone::getOffset() now accepts a DateTimeInterface
  Moved checks and error reporting related to static methods from DO_FCALL inti INTI_FCALL* opcodes that may really deal with static methods. (In some rare cases it may lead to different order of warning messages).
  Fixed a bug that causes crash when environment variable is access while parsing php.ini
  Fixed a bug that causes crash when environment variable is access while parsing php.ini
2014-10-05 19:26:17 +02:00
Dmitry Stogov
7c7b9184b1 Fixed list() behavior inconsistency (string handling is disabled for all cases, ArrayAccess objects handling is enabled for all cases, ZEND_FETCH_DIM_TMP_VAR opcode is renamed into ZEND_FETCH_LIST, ZEND_FETCH_ADD_LOCK flag is removed). 2014-10-05 13:02:58 +04:00
Anatol Belski
ee4ae7fbc3 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  remove the remains of dsp files handling
  fix EX usage
  remove misprint parentheses
  remove misprint parentheses
  Replaced EG(This) and EX(object) with EX(This). Internal functions now recieves zend_execute_data as the first argument.
  And this one...
  It should be in extern c
  Remove useless condition
  NEWS entry for previous commit
  NEWS entry for previous commit
  add IPv6 support to php-fpm
  Micro optimization for the most frequency case
  Add hash to EXTENSIONS file
  Remove extensions which are long gone
  we also have xz release tarballs since 5.5
  Fix ZTS build
  improved file size computation in stat()
  Fixed incorrect compilation
  5.5.19 now
2014-10-03 20:30:49 +02:00
Dmitry Stogov
ccb24caa6d Fixed incorrect compilation 2014-10-02 13:37:44 +04:00
Anatol Belski
d624b0d5eb Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (26 commits)
  Micro optimization
  Drop unused INIT_STRING opcode
  Drop unused RAISE_ABSTRACT_ERROR opcode
  CT substitute unqualified true/false/null in namespaces
  Fix a couple compile warnings
  fix test filename
  one more test to illustrate transfer of an arbitrary data amount throug pipes
  fix tests on linux
  better test cleanup
  Use more readable inline functions
  increase the polling period to not to break existing behaviours
  updated NEWS
  Fixed bug #51800 proc_open on Windows hangs forever
  Fixed segfault
  Set an LDAP error code when failing ldap_bind due to null bytes
  Fix segmentation fault in debug_backtrace()
  Drop support for GMP 4.1
  Make gmp_setbit and gmp_clrbit return values consistent
  removed *.dsw and *.dsp files
  Opcache compatibility for coalesce operator
  ...
2014-10-01 01:33:46 +02:00
Nikita Popov
290d71de75 Drop unused RAISE_ABSTRACT_ERROR opcode
Abstract methods are being prevented from being called in DO_FCALL
etc.
2014-09-29 22:50:56 +02:00
Nikita Popov
ab288b01d5 CT substitute unqualified true/false/null in namespaces
Substituation now always happens on the resolved name and
unqualified usages of true/false/null in namespaced code are
substituted as well.
2014-09-29 21:18:12 +02:00
Nikita Popov
877eb02fd6 Update operand types for coalesce operator 2014-09-28 12:20:04 +02:00
Andrea Faulds
2d069f640e Merge branch 'coalesce_operator'
* coalesce_operator:
  Extended coalesce operator test case for ordering/short-circuiting
  Ensure not evaluated twice
  Added test
  Initial coalesce operator implementation
2014-09-28 00:07:04 +01:00
Anatol Belski
06d0230a0f cleanup TSRMLS_FETCH 2014-09-26 09:58:19 +02:00
Anatol Belski
d11734b4b0 reworked the patch, less new stuff but worky
TLS is already used in TSRM, the way exporting the tsrm cache through
a thread local variable is not portable. Additionally, the current
patch suffers from bugs which are hard to find, but prevent it to
be worky with apache. What is done here is mainly uses the idea
from the RFC patch, but

- __thread variable is removed
- offset math and declarations are removed
- extra macros and definitions are removed

What is done merely is

- use an inline function to access the tsrm cache. The function uses
  the portable tsrm_tls_get macro which is cheap
- all the TSRM_* macros are set to placebo. Thus this opens the way
  remove them later

Except that, the logic is old. TSRMLS_FETCH will have to be done once
per thread, then tsrm_get_ls_cache() can be used. Things seeming to be
worky are cli, cli server and apache. I also tried to enable bz2
shared and it has worked out of the box. The change is yet minimal
diffing to the current master bus is a worky start, IMHO. Though will
have to recheck the other previously done SAPIs - embed and cgi.

The offsets can be added to the tsrm_resource_type struct, then
it'll not be needed to declare them in the userspace. Even the
"done" member type can be changed to int16 or smaller, then adding
the offset as int16 will not change the struct size. As well on the
todo might be removing the hashed storage, thread_id != thread_id and
linked list logic in favour of the explicit TLS operations.
2014-09-25 18:48:27 +02:00
Anatol Belski
a2dd606942 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (31 commits)
  Fixed C++ incompatibility
  update the certificate used for the test, as it expired recently
  Fixed immutable arrays support
  Fix counting of "R:" references in serialize()
  Remove dead code
  Test use($this) being an error
  Move list() condition into assign_znode
  typo
  NEWS
  Fix bug #68074 Allow to use system cipher list instead of hardcoded value
  Avoid double checks
  the order of the blocks should be Core, then exts in alphabetical order
  add missing NEWS entry for the phpdbg compilation fix
  add NEWS entry for #68088
  Make QM_ASSIGN, JMP_SET and CAST return IS_TMP_VAR.
  Removed useless helper
  Drop unused result argument
  Fix ct binding for cuf/cufa functions
  Fix detection of write to built-in function for references
  Test use of string names with \ prefix
  ...
2014-09-24 21:39:49 +02:00
Nikita Popov
3e042e1f83 Move list() condition into assign_znode
The condition in compile_foreach was using ->attr instead of ->kind
and as such never passed. It only worked because assign_znode already
supported this case by indirecting via zend_compile_assign. Now it
implements it with a direct call.
2014-09-24 12:06:18 +02:00
Dmitry Stogov
58a41cf795 Make QM_ASSIGN, JMP_SET and CAST return IS_TMP_VAR. 2014-09-24 01:57:40 +04:00
Nikita Popov
4a221bd881 Drop unused result argument 2014-09-23 21:04:30 +02:00
Nikita Popov
67a5ca6697 Fix ct binding for cuf/cufa functions
It was checking against the wrong AST kind, so the binding was
never actually done.
2014-09-23 21:02:32 +02:00
Nikita Popov
9070eb38e9 Fix detection of write to built-in function for references 2014-09-23 20:42:22 +02:00
Nikita Popov
231dcc94e8 Test use of string names with \ prefix
And drop piece of dead code
2014-09-23 20:36:00 +02:00
Nikita Popov
182ddfeaf2 Add zend_add_literal_string
And simplify additional of special literals based on it.
2014-09-23 20:21:28 +02:00
Nikita Popov
4571271de1 Drop dead code 2014-09-23 19:32:02 +02:00
Dmitry Stogov
06103d65b1 Use zval_ptr_dtor_nogc() to free IS_TMP_VAR operands.
Removed ZEND_SWITCH_FREE opcode (ZEND_FREE used instead).
2014-09-23 17:21:29 +04:00
Nikita Popov
75533c9b23 Test a few more error conditions in the compiler 2014-09-23 00:57:00 +02:00
Nikita Popov
51119054ff Test error conditions for ct class const refs
And fix a bug found while doing so...
2014-09-23 00:40:17 +02:00
Anatol Belski
7099736dfa Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  Fix tests/serialize/bug64146.phpt
  Remove zend_dynamic_array
  Remove static allocator
  Fixed typo
  Fix list() destructuring to special variables
  Remove php_varname_check
  Avoid useless reference counting
  Specialization (only IS_VAR ad IS_CV operands may be references)
  Optimized unset()
  Make error paths to be UNEXPECTED
  Replace IS_OP?_TMP_FREE() with more clear (OP?_TYPE == IS_TMP_VAR)
2014-09-23 00:32:48 +02:00
Nikita Popov
f30f28ec47 Fix list() destructuring to special variables 2014-09-22 18:34:40 +02:00
Anatol Belski
6bb530d1eb Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (24 commits)
  added a comment
  fix the REPARSE_DATA_BUFFER struct def
  simplify the condition
  Fix two memory errors by interning earlier
  Add smart_str_append for appending zend_strings
  Rename smart_str_append to smart_str_append_smart_str
  Use smart_str for exception stack traces
  Use smart_str in get_function_declaration
  Move smart_str implementation into Zend/
  UPGRADING for Integer Semantics
  Fixed bug #66242 (don't assume char is signed)
  Fixed bug #67633
  Fixed if/else if ordering
  Use SIZEOF_ZEND_LONG instead of SIZEOF_LONG
  Use zend_ polyfilled nan/finite, check finite
  Updated 32-bit << test
  Updated << 64-bit tests
  Prevent bit shift count wrapping quirkiness on some CPUs for left shift
  Cast NaN and Infinity to zero
  Updated >> 64-bit tests
  ...
2014-09-22 10:26:17 +02:00
Nikita Popov
7d4c81d8d9 Fix two memory errors by interning earlier 2014-09-21 23:56:09 +02:00
Nikita Popov
6219a4e844 Merge branch 'PHP-5.6'
Conflicts:
	Zend/zend_compile.c
2014-09-20 21:58:06 +02:00
Nikita Popov
308c0a727e Merge branch 'PHP-5.5' into PHP-5.6 2014-09-20 21:47:59 +02:00
Nikita Popov
5e977e69e1 Fixed bug #67633 2014-09-20 21:46:25 +02:00
krakjoe
b3aebda9ea native tls initial patch 2014-09-20 20:22:14 +01:00
Nikita Popov
98891ee118 Simplify foreach flags
* FE_RESET_VARIABLE and FE_RESET_REFERENCE were always set
   together.
 * In some places the code checked FE_FETCH_BYREF instead of
   FE_RESET_REFERENCE and relied on them having the same value.
 * Now the FE_RESET_* flags are dropped and everything uses
   FE_FETCH_BYREF
2014-09-20 12:56:05 +02:00
Xinchen Hui
95836a3504 Avoid strlen usage 2014-09-20 15:27:36 +08:00
Nikita Popov
c7446bbd39 Remove superfluous Z_REFCOUNTED_P check
The string is never interned and IS_CONSTANT_EX is always refcounted.
2014-09-19 23:39:06 +02:00
Nikita Popov
c343ca4efb Split inheritance into separate file
This moves handling of inheritance and interface implementation
from zend_compile.c into a separate zend_inheritance.c file, as
this is not really related to compilation.
2014-09-19 19:54:37 +02:00
Dmitry Stogov
bccc653185 Avoid double IS_INTERNED() check 2014-09-19 17:32:50 +04:00
Dmitry Stogov
35f8467687 Reverted incorrect chunk 2014-09-19 17:05:03 +04:00
Dmitry Stogov
3bc8a958c5 Fixed useless or duplicated IS_INTERNED() checks 2014-09-19 15:41:01 +04:00
Dmitry Stogov
551ee4165b Use runtime-cache to avoid hash lookups in BIND_GLOBAL instruction 2014-09-17 00:52:45 +04:00