Commit Graph

696 Commits

Author SHA1 Message Date
Reeze Xia
7409fd4bf7 Fix folder mark 2015-03-14 14:06:57 +08:00
Dmitry Stogov
8633685675 Use specialized macro for string zval creation 2015-03-12 16:53:51 +03:00
Dmitry Stogov
a30d328671 Errors converted to exceptions are not "recoverable" anymore. 2015-03-10 10:31:55 +03:00
Dmitry Stogov
1c94ff0595 Implement engine exceptions
RFC: https://wiki.php.net/rfc/engine_exceptions_for_php7

Pending changes regarding naming of BaseException and whether it
should be an interface.
2015-03-09 14:01:32 +01:00
Nikita Popov
a4262827ea Fix ReflectionFunction::isDeprecated() test
We currently don't have deprecated functions ... so just switch
this to testing a non-deprecated function.
2015-03-09 12:27:06 +01:00
Adam Harvey
10c471a60b Use a deprecated function that still exists. 2015-03-05 00:51:05 +00:00
Adam Harvey
fea9a6fc77 Merge remote-tracking branch 'datibbaw/kill-ereg'
Conflicts:
	ext/ereg/config.w32
	ext/ereg/config0.m4
	ext/ereg/ereg.c
	ext/ereg/php_ereg.h
	ext/ereg/php_regex.h
	ext/ereg/regex/engine.c
	ext/ereg/regex/main.c
	ext/ereg/regex/regcomp.c
	ext/ereg/regex/regerror.c
	ext/ereg/tests/split_error_002.phpt
	ext/ereg/tests/split_variation_003.phpt
	ext/ereg/tests/spliti_error_002.phpt
	ext/ereg/tests/spliti_variation_003.phpt
	ext/pgsql/pgsql.c
	sapi/apache/php_apache_http.h
	sapi/apache_hooks/php_apache_http.h
2015-03-05 00:21:38 +00: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
Dmitry Stogov
d85113702c Lazy duplication of op_array->static_variables 2015-02-20 13:28:26 +03:00
Nikita Popov
240fbd36f1 Add test to ensure ReflectionClass works correctly with traits
Some of these were not working correctly before Guilherme's patch.
Another was broken by it and is fixed in this commit as well.
2015-02-12 23:25:09 +01: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
Bob Weinand
4cd3995475 Add a constant of type CONST_PERSISTENT to test 2015-02-10 22:53:50 +01: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
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
Dmitry Stogov
1eb4352143 Use new ZEND_HASH_FOREACH_... API. 2015-02-10 15:43:12 +03: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
Stanislav Malyshev
911f0ea417 Merge branch 'pull-request/1012'
* pull-request/1012:
  Fix uninitalized variables reads. See CWE-457 for more info.
2015-01-31 23:52:10 -08:00
Stanislav Malyshev
e8e0481755 Merge branch 'pull-request/994'
* pull-request/994:
  Added test and possible fix for https://bugs.php.net/bug.php?id=67068
2015-01-31 23:12:00 -08: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
Dmitry Stogov
3e31838d19 zend_read_property() has to provide a holder for return value.
Previously it was possible that zend_read_property() returned pointer to zval allocated on stack.
2015-01-22 11:50:42 +03:00
Joshua Rogers
6621840951 Fix uninitalized variables reads. See CWE-457 for more info. 2015-01-21 06:52:19 +11:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Dmitry Stogov
7e93de101f Handle run-time cache for static properties directly in executor.
Removed cache_slot argument in zend_std_get_static_property() and zend_std_unset_static_property().
2015-01-13 09:33:15 +03:00
Danack
1397790560 Added test and possible fix for https://bugs.php.net/bug.php?id=67068 2015-01-13 01:24:19 +00:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Nikita Popov
2d212b426a Drop duplicate arg from hash_get_current_key_ex 2014-12-26 21:06:18 +01: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
Andrea Faulds
e5eb9530ab Use "float" and "integer" in typehint and zpp errors 2014-12-21 13:23:02 +00: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
Guilherme Blanco
094d409b3d 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. 2014-12-12 17:29:54 +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
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
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
Stanislav Malyshev
704e4fe605 Merge branch 'PHP-5.6'
* PHP-5.6:
  update NEWS
  Fix incorrect argument reflection info for array_multisort()
2014-11-23 16:40:16 -08:00
Alexander Lisachenko
a5aae1b66c Fix incorrect argument reflection info for array_multisort() 2014-11-23 16:38:30 -08: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
Anatol Belski
3b4a6dc114 removed useless check
the offset member is an unsigned
2014-11-14 17:39:35 +01:00
Dmitry Stogov
75041379a6 Improved object property access. 2014-11-06 14:50:03 +03:00
Anatol Belski
897695764c fix datatype mismatches
sizeof(struct _string) doesn't increase.
2014-10-29 15:30:14 +01:00
Anatol Belski
9cbdf3e66a Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
  Fixed compilation
  Optimized property access handlers. Removed EG(std_property_info).
  Fixed bug #68199 (PDO::pgsqlGetNotify doesn't support NOTIFY payloads)
  News entry for new curl constants
2014-10-18 03:31:02 +02:00
Dmitry Stogov
7471c21781 Optimized property access handlers. Removed EG(std_property_info). 2014-10-17 19:10:05 +04:00
Anatol Belski
7a6a3d923b fix arg order, CFLAGS is the fifth arg in m4 2014-10-17 16:03:40 +02:00
Anatol Belski
0490a32249 more exts converted for static tsrm ls pointer
mbstring, pcre, reflection
2014-10-15 19:19:23 +02:00
Nikita Popov
c4ab08ac9d Fix invalid zend_string_frees in reflection
zend_lookup_class can share the name
2014-10-12 20:55:51 +02:00
Nikita Popov
ee5b30fa19 Remove support for classes without class entries
get_class_entry must be non-NULL and return non-NULL.
2014-10-09 13:58:14 +02:00
Johannes Schlüter
429e1b45a7 Merge branch 'PHP-5.6' 2014-10-04 20:07:00 +02:00
Johannes Schlüter
79ca53b62b Merge branch 'PHP-5.5' into PHP-5.6 2014-10-04 20:06:44 +02:00